Skip to content

Commit ce11f9e

Browse files
committed
---
yaml --- r: 4133 b: refs/heads/master c: f110c20 h: refs/heads/master i: 4131: c3ffad7 v: v3
1 parent eed68f4 commit ce11f9e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 067cb6d53751b2c93d3e1ea45e7547069f865e6a
2+
refs/heads/master: f110c206097e9483cbe68be50eca80ac63abcbbd

trunk/src/test/compiletest/compiletest.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ mod procsrv {
525525
export run;
526526
export close;
527527

528-
type handle = chan[request];
528+
type handle = rec(option::t[task] task,
529+
chan[request] chan);
529530

530531
tag request {
531532
exec(str, str, vec[str], chan[response]);
@@ -535,22 +536,28 @@ mod procsrv {
535536
type response = rec(int pid, int outfd);
536537

537538
fn mk() -> handle {
538-
task::worker(worker).chan
539+
auto res = task::worker(worker);
540+
ret rec(task = option::some(res.task),
541+
chan = res.chan);
539542
}
540543

541544
fn clone(&handle handle) -> handle {
542-
task::clone_chan(handle)
545+
// Sharing tasks across tasks appears to be (yet another) recipe for
546+
// disaster, so our handle clones will not get the task pointer.
547+
rec(task = option::none,
548+
chan = task::clone_chan(handle.chan))
543549
}
544550

545551
fn close(&handle handle) {
546-
task::send(handle, stop);
552+
task::send(handle.chan, stop);
553+
task::join(option::get(handle.task));
547554
}
548555

549556
fn run(&handle handle, &str lib_path,
550557
&str prog, &vec[str] args) -> rec(int status, str out) {
551558
auto p = port[response]();
552559
auto ch = chan(p);
553-
task::send(handle,
560+
task::send(handle.chan,
554561
exec(lib_path, prog, args, ch));
555562

556563
auto resp = task::recv(p);

0 commit comments

Comments
 (0)