Skip to content

Commit fdc63f8

Browse files
committed
Remove Send bounds from ScopeBuilder
1 parent 99e87af commit fdc63f8

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

rayon-core/src/scope/mod.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,23 @@ impl<'scope> ScopeBuilder<'scope> {
3434

3535
pub fn scope<OP, R>(&'scope mut self, op: OP) -> R
3636
where
37-
OP: FnOnce(&'scope Scope<'scope>) -> R + 'scope + Send,
38-
R: Send,
37+
OP: FnOnce(&'scope Scope<'scope>) -> R + 'scope,
3938
{
40-
in_worker(move |owner_thread, _| {
41-
unsafe {
42-
self.scope = Some(Scope {
43-
owner_thread_index: owner_thread.index(),
44-
registry: owner_thread.registry().clone(),
45-
panic: AtomicPtr::new(ptr::null_mut()),
46-
job_completed_latch: CountLatch::new(),
47-
marker: PhantomData,
48-
});
49-
let scope = self.scope.as_ref().unwrap();
50-
let result = scope.execute_job_closure(move |_| op(scope));
39+
unsafe {
40+
self.scope = Some(Scope {
41+
owner_thread_index: 0,
42+
registry: Registry::current(),
43+
panic: AtomicPtr::new(ptr::null_mut()),
44+
job_completed_latch: CountLatch::new(),
45+
marker: PhantomData,
46+
});
47+
let scope = self.scope.as_ref().unwrap();
48+
let result = scope.execute_job_closure(move |_| op(scope));
49+
in_worker(move |owner_thread, _| {
5150
scope.steal_till_jobs_complete(owner_thread);
52-
result.unwrap() // only None if `op` panicked, and that would have been propagated
53-
}
54-
})
51+
});
52+
result.unwrap() // only None if `op` panicked, and that would have been propagated
53+
}
5554
}
5655
}
5756

0 commit comments

Comments
 (0)