diff options
| author | Michael Bebenita <mbebenita@mozilla.com> | 2010-08-09 08:15:34 -0700 |
|---|---|---|
| committer | Michael Bebenita <mbebenita@mozilla.com> | 2010-08-09 08:15:34 -0700 |
| commit | 97d6342bf08e55f8d2b4f8df5c4b5a099df0191c (patch) | |
| tree | bfed15fefbc032deba1c34908f25c1562d88aa6b /src/rt/rust_task.cpp | |
| parent | 5917ca35190b526b65b4d26ad0b98024ce9e0b09 (diff) | |
| download | rust-97d6342bf08e55f8d2b4f8df5c4b5a099df0191c.tar.gz rust-97d6342bf08e55f8d2b4f8df5c4b5a099df0191c.zip | |
Synthesize a flush_chan upcall right before a channel's ref_count drops to zero. This should only happen in the Rust code and not in the drop glue, or on the unwind path. This change allows the task owning the channel to block on a flush and delete its own channel. This change also cleans up some code around rust_port and rust_chan.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index c8831e8e05b..f52db868e02 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -323,6 +323,11 @@ get_callee_save_fp(uintptr_t *top_of_callee_saves) void rust_task::kill() { + if (dead()) { + // Task is already dead, can't kill what's already dead. + return; + } + // Note the distinction here: kill() is when you're in an upcall // from task A and want to force-fail task B, you do B->kill(). // If you want to fail yourself you do self->fail(upcall_nargs). |
