Content-Length: 301136 | pFad | https://github.com/celinval/rust-dev/commit/55f3d10071cc5038b7bfc6642c837aa5dafbf335

08 Store `Task::p` as `dyn FnOnce() + Send` · celinval/rust-dev@55f3d10 · GitHub
Skip to content

Commit 55f3d10

Browse files
committed
Store Task::p as dyn FnOnce() + Send
1 parent 92b604f commit 55f3d10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

std/src/sys/pal/sgx/thread.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ mod task_queue {
2828
}
2929

3030
pub(super) struct Task {
31-
p: Box<dyn FnOnce()>,
31+
p: Box<dyn FnOnce() + Send>,
3232
done: JoinNotifier,
3333
}
3434

3535
unsafe impl Send for Task {}
3636

3737
impl Task {
38-
pub(super) fn new(p: Box<dyn FnOnce()>) -> (Task, JoinHandle) {
38+
pub(super) fn new(p: Box<dyn FnOnce() + Send>) -> (Task, JoinHandle) {
3939
let (done, recv) = wait_notify::new();
4040
let done = JoinNotifier(Some(done));
4141
(Task { p, done }, recv)
@@ -97,7 +97,7 @@ pub mod wait_notify {
9797

9898
impl Thread {
9999
// unsafe: see thread::Builder::spawn_unchecked for safety requirements
100-
pub unsafe fn new(_stack: usize, p: Box<dyn FnOnce()>) -> io::Result<Thread> {
100+
pub unsafe fn new(_stack: usize, p: Box<dyn FnOnce() + Send>) -> io::Result<Thread> {
101101
let mut queue_lock = task_queue::lock();
102102
unsafe { usercalls::launch_thread()? };
103103
let (task, handle) = task_queue::Task::new(p);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/celinval/rust-dev/commit/55f3d10071cc5038b7bfc6642c837aa5dafbf335

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy