spawn_worker_thread

Function spawn_worker_thread 

Source
pub fn spawn_worker_thread<F0, F1>(
    thread_name: &str,
    thread_stack_size: usize,
    thread_handler: Arc<AtomicBool>,
    thread_waker: Arc<(AtomicBool, Mutex<()>, Condvar)>,
    sleep_timeout: u64,
    loop_interval: Option<u64>,
    loop_func: F0,
    get_queue_len: F1,
) -> Arc<AtomicBool>
where F0: Fn() -> (bool, Duration) + Send + 'static, F1: Fn() -> usize + Send + 'static,
Expand description

派发一个工作线程 返回线程的句柄,可以通过句柄关闭线程 线程在没有任务可以执行时会休眠,当派发任务或唤醒任务时会自动唤醒线程