Store Task::p
as dyn FnOnce() + Send
This commit is contained in:
parent
9b2e41a218
commit
b8c6008fbc
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue