aboutsummaryrefslogtreecommitdiff
path: root/src/spawn/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/spawn/mod.rs')
-rw-r--r--src/spawn/mod.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/spawn/mod.rs b/src/spawn/mod.rs
index 0006103..1aa9edb 100644
--- a/src/spawn/mod.rs
+++ b/src/spawn/mod.rs
@@ -73,7 +73,7 @@ where
F: FnOnce() + Send + 'static,
{
// We assert that this does not hold any references (we know
- // this because of the `'static` bound in the inferface);
+ // this because of the `'static` bound in the interface);
// moreover, we assert that the code below is not supposed to
// be able to panic, and hence the data won't leak but will be
// enqueued into some deque for later execution.
@@ -91,19 +91,14 @@ where
// executed. This ref is decremented at the (*) below.
registry.increment_terminate_count();
- Box::new(HeapJob::new({
- let registry = registry.clone();
+ HeapJob::new({
+ let registry = Arc::clone(registry);
move || {
- match unwind::halt_unwinding(func) {
- Ok(()) => {}
- Err(err) => {
- registry.handle_panic(err);
- }
- }
+ registry.catch_unwind(func);
registry.terminate(); // (*) permit registry to terminate now
}
- }))
- .as_job_ref()
+ })
+ .into_static_job_ref()
}
/// Fires off a task into the Rayon threadpool in the "static" or
@@ -148,7 +143,7 @@ where
F: FnOnce() + Send + 'static,
{
// We assert that this does not hold any references (we know
- // this because of the `'static` bound in the inferface);
+ // this because of the `'static` bound in the interface);
// moreover, we assert that the code below is not supposed to
// be able to panic, and hence the data won't leak but will be
// enqueued into some deque for later execution.
@@ -159,7 +154,7 @@ where
// in a locally-FIFO order. Otherwise, just use the pool's global injector.
match registry.current_thread() {
Some(worker) => worker.push_fifo(job_ref),
- None => registry.inject(&[job_ref]),
+ None => registry.inject(job_ref),
}
mem::forget(abort_guard);
}