mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 13:26: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.
|
/// Options to create or spawn a new kernel thread.
|
||||||
pub struct ThreadOptions {
|
pub struct ThreadOptions {
|
||||||
func: Option<Box<dyn Fn() + Send + Sync>>,
|
func: Option<Box<dyn FnOnce() + Send>>,
|
||||||
priority: Priority,
|
priority: Priority,
|
||||||
cpu_affinity: CpuSet,
|
cpu_affinity: CpuSet,
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ impl ThreadOptions {
|
|||||||
/// Creates the thread options with the thread function.
|
/// Creates the thread options with the thread function.
|
||||||
pub fn new<F>(func: F) -> Self
|
pub fn new<F>(func: F) -> Self
|
||||||
where
|
where
|
||||||
F: Fn() + Send + Sync + 'static,
|
F: FnOnce() + Send + 'static,
|
||||||
{
|
{
|
||||||
let cpu_affinity = CpuSet::new_full();
|
let cpu_affinity = CpuSet::new_full();
|
||||||
Self {
|
Self {
|
||||||
|
@ -149,7 +149,7 @@ impl TaskOptions {
|
|||||||
/// Creates a set of options for a task.
|
/// Creates a set of options for a task.
|
||||||
pub fn new<F>(func: F) -> Self
|
pub fn new<F>(func: F) -> Self
|
||||||
where
|
where
|
||||||
F: FnOnce() + Send + Sync + 'static,
|
F: FnOnce() + Send + 'static,
|
||||||
{
|
{
|
||||||
Self {
|
Self {
|
||||||
func: Some(Box::new(func)),
|
func: Some(Box::new(func)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user