diff --git a/Cargo.lock b/Cargo.lock index 56111a8..c874d0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -998,6 +998,10 @@ dependencies = [ "log", ] +[[package]] +name = "kubi-pool" +version = "0.0.0" + [[package]] name = "kubi-server" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index 54fa66e..e3f4e75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["kubi", "kubi-server", "kubi-shared", "kubi-logging"] +members = ["kubi", "kubi-server", "kubi-shared", "kubi-logging", "kubi-pool"] resolver = "2" [profile.release-with-debug] diff --git a/kubi-logging/Cargo.toml b/kubi-logging/Cargo.toml index 582dad6..dd17671 100644 --- a/kubi-logging/Cargo.toml +++ b/kubi-logging/Cargo.toml @@ -2,6 +2,7 @@ name = "kubi-logging" version = "0.1.0" edition = "2021" +publish = false [dependencies] log = "0.4" diff --git a/kubi-pool/Cargo.toml b/kubi-pool/Cargo.toml new file mode 100644 index 0000000..094c198 --- /dev/null +++ b/kubi-pool/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "kubi-pool" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies] diff --git a/kubi-pool/src/lib.rs b/kubi-pool/src/lib.rs new file mode 100644 index 0000000..066aa53 --- /dev/null +++ b/kubi-pool/src/lib.rs @@ -0,0 +1,33 @@ +use std::{thread::JoinHandle, collections::VecDeque}; + +pub struct KubiPool { + callback: fn(T) -> R, + threads: Vec>, +} + +struct Task { + priority: u8, + data: T, +} + +fn task_loop() { + let tasks = VecDeque::>::new(); + loop { + //todo + }; +} + +impl KubiPool { + pub fn new(threads: usize, callback: fn(T) -> R) -> Self { + Self { + callback, + threads: (0..threads).map(|_| { + std::thread::spawn(task_loop::) + }).collect(), + } + } + + pub fn resize(&mut self, threads: usize) { + + } +}