You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
507 B

pub struct ThreadPool;
// ANCHOR: here
impl ThreadPool {
7 months ago
/// 创建一个新的线程池。
///
7 months ago
/// size 是池中线程的数量。
///
/// # Panics
///
7 months ago
/// 如果 size 为 0`new` 方法会 panic。
pub fn new(size: usize) -> ThreadPool {
assert!(size > 0);
ThreadPool
}
// --snip--
// ANCHOR_END: here
pub fn execute<F>(&self, f: F)
where
F: FnOnce() + Send + 'static,
{
}
// ANCHOR: here
}
// ANCHOR_END: here