Skip to content

Commit

Permalink
Store Task::p as dyn FnOnce() + Send
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulstrackx committed Jun 4, 2024
1 parent 92b604f commit 55f3d10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions std/src/sys/pal/sgx/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ mod task_queue {
}

pub(super) struct Task {
p: Box<dyn FnOnce()>,
p: Box<dyn FnOnce() + Send>,
done: JoinNotifier,
}

unsafe impl Send for Task {}

impl Task {
pub(super) fn new(p: Box<dyn FnOnce()>) -> (Task, JoinHandle) {
pub(super) fn new(p: Box<dyn FnOnce() + Send>) -> (Task, JoinHandle) {
let (done, recv) = wait_notify::new();
let done = JoinNotifier(Some(done));
(Task { p, done }, recv)
Expand Down Expand Up @@ -97,7 +97,7 @@ pub mod wait_notify {

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

0 comments on commit 55f3d10

Please sign in to comment.