From 5795b74d8e3fb5a275f7d57d2621355cad61b886 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Mon, 9 Feb 2026 20:05:08 +0100 Subject: [PATCH] #14 threadpool #3 --- src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3a3c50a..456e722 100644 --- a/src/main.rs +++ b/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>, } 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} } }