Use FnOnce() + Send as task func

This commit is contained in:
Ruihan Li
2025-01-19 08:45:04 +09:00
committed by Tate, Hongliang Tian
parent 6a865062e6
commit 2cf4aebe7a
2 changed files with 3 additions and 3 deletions

View File

@ -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 {