about summary refs log tree commit diff
path: root/src/libnative/task.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-30 17:06:18 +0000
committerbors <bors@rust-lang.org>2014-07-30 17:06:18 +0000
commit7a25cf3f30fa5fae2e868fa910ecc850f5e9ee65 (patch)
tree008d8b16797b8beb73c0e683f2bff73527118252 /src/libnative/task.rs
parentf6814206247d20a523e3cb1def5dad704c019cb1 (diff)
parent8643a0d61359dfb1ebe38d4aae615e7c836b3d18 (diff)
downloadrust-7a25cf3f30fa5fae2e868fa910ecc850f5e9ee65.tar.gz
rust-7a25cf3f30fa5fae2e868fa910ecc850f5e9ee65.zip
auto merge of #15944 : alexcrichton/rust/task-dont-die, r=brson
Previously both spawning mechanisms were not resilient to task failures which were initiated from the task spawning infrastructure.

Closes #15895
Diffstat (limited to 'src/libnative/task.rs')
-rw-r--r--src/libnative/task.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libnative/task.rs b/src/libnative/task.rs
index 35367ff2efa..c72d6c24a7c 100644
--- a/src/libnative/task.rs
+++ b/src/libnative/task.rs
@@ -71,7 +71,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) {
     // Note that this increment must happen *before* the spawn in order to
     // guarantee that if this task exits it will always end up waiting for the
     // spawned task to exit.
-    bookkeeping::increment();
+    let token = bookkeeping::increment();
 
     // Spawning a new OS thread guarantees that __morestack will never get
     // triggered, but we must manually set up the actual stack bounds once this
@@ -93,7 +93,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) {
         let mut task = task;
         task.put_runtime(ops);
         drop(task.run(|| { f.take_unwrap()() }).destroy());
-        bookkeeping::decrement();
+        drop(token);
     })
 }