parent
8d101ee6e9
commit
5795b74d8e
1 changed files with 8 additions and 4 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -5,8 +5,8 @@ use std::thread;
|
|||
|
||||
static GET: &'static [u8] = b"GET / HTTP/1.1\r\n";
|
||||
|
||||
pub struct ThreadPool{
|
||||
|
||||
pub struct ThreadPool {
|
||||
threads: Vec<thread::JoinHandle<()>>,
|
||||
}
|
||||
|
||||
impl ThreadPool {
|
||||
|
|
@ -15,9 +15,13 @@ impl ThreadPool {
|
|||
/// # Panics
|
||||
///
|
||||
/// The `new` function panics if the size is zero
|
||||
pub fn new(size: usize) -> ThreadPool {
|
||||
pub fn new(size: usize) -> Self {
|
||||
assert!(size > 0);
|
||||
Self{}
|
||||
let threads = Vec::with_capacity(size);
|
||||
for _ in 0..size {
|
||||
|
||||
}
|
||||
Self {threads}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue