mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-08 21:06:48 +00:00
Use FnOnce() + Send
as task func
This commit is contained in:
parent
6a865062e6
commit
2cf4aebe7a
@ -13,7 +13,7 @@ struct KernelThread;
|
||||
|
||||
/// Options to create or spawn a new kernel thread.
|
||||
pub struct ThreadOptions {
|
||||
func: Option<Box<dyn Fn() + Send + Sync>>,
|
||||
func: Option<Box<dyn FnOnce() + Send>>,
|
||||
priority: Priority,
|
||||
cpu_affinity: CpuSet,
|
||||
}
|
||||
@ -22,7 +22,7 @@ impl ThreadOptions {
|
||||
/// Creates the thread options with the thread function.
|
||||
pub fn new<F>(func: F) -> Self
|
||||
where
|
||||
F: Fn() + Send + Sync + 'static,
|
||||
F: FnOnce() + Send + 'static,
|
||||
{
|
||||
let cpu_affinity = CpuSet::new_full();
|
||||
Self {
|
||||
|
@ -149,7 +149,7 @@ impl TaskOptions {
|
||||
/// Creates a set of options for a task.
|
||||
pub fn new<F>(func: F) -> Self
|
||||
where
|
||||
F: FnOnce() + Send + Sync + 'static,
|
||||
F: FnOnce() + Send + 'static,
|
||||
{
|
||||
Self {
|
||||
func: Some(Box::new(func)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user