diff options
| author | Ben Striegel <ben.striegel@gmail.com> | 2013-02-27 19:13:53 -0500 |
|---|---|---|
| committer | Ben Striegel <ben.striegel@gmail.com> | 2013-02-27 19:14:19 -0500 |
| commit | 43d43adf6bd2024b1ddc0e596d4bed88e1df82b1 (patch) | |
| tree | 62bc69f2ad5f4e78dfef71a5555e1be4b4ec3aed /src/libcore/task/spawn.rs | |
| parent | 33e7a1f087b3b8047891b91fa95c5626042e7f6e (diff) | |
| download | rust-43d43adf6bd2024b1ddc0e596d4bed88e1df82b1.tar.gz rust-43d43adf6bd2024b1ddc0e596d4bed88e1df82b1.zip | |
Turn old `drop` blocks into `Drop` traits
Diffstat (limited to 'src/libcore/task/spawn.rs')
| -rw-r--r-- | src/libcore/task/spawn.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 5110f70ff11..bf7209f9fc3 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -308,8 +308,11 @@ struct TCB { mut ancestors: AncestorList, is_main: bool, notifier: Option<AutoNotify>, +} + +impl Drop for TCB { // Runs on task exit. - drop { + fn finalize(&self) { unsafe { // If we are failing, the whole taskgroup needs to die. if rt::rust_task_is_unwinding(self.me) { @@ -353,7 +356,10 @@ fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList, struct AutoNotify { notify_chan: Chan<TaskResult>, mut failed: bool, - drop { +} + +impl Drop for AutoNotify { + fn finalize(&self) { let result = if self.failed { Failure } else { Success }; self.notify_chan.send(result); } |
