/// Initialize the dynamic pool
/// That will be scaled
Initialize the dynamic pool
That will be scaled
Initialize the dynamic pool That will be scaled
pub fn initialize(&'static self) {
        // Static thread manager that will always be available
        trace!("setting up the static thread manager");
        (0..self.static_threads).for_each(|_| {
            let clone = Arc::clone(&self.runner);
            thread::Builder::new()
                .name("bastion-driver-static".to_string())
                .spawn(move || {
                    Self::affinity_pinner();
                    clone.run_static(THREAD_PARK_TIMEOUT);
                })
                .expect("couldn't spawn static thread");
        });
        // Dynamic thread manager that will allow us to unpark threads
        // According to the needs
        trace!("setting up the dynamic thread manager");
        (0..self.dynamic_threads).for_each(|_| {
            let clone = Arc::clone(&self.runner);
            thread::Builder::new()
                .name("bastion-driver-dynamic".to_string())
                .spawn(move || {
                    Self::affinity_pinner();
                    clone.run_dynamic(&|| self.park_thread());
                })
                .expect("cannot start dynamic thread");
        });
        // Pool manager to check frequency of task rates
        // and take action by scaling the pool accordingly.
        thread::Builder::new()
            .name("bastion-pool-manager".to_string())
            .spawn(move || {
                let poll_interval = Duration::from_millis(SCALER_POLL_INTERVAL);
                trace!("setting up the pool manager");
                loop {
                    self.scale_pool();
                    thread::park_timeout(poll_interval);
                }
            })
            .expect("thread pool manager cannot be started");
    }
pub fn initialize ( & ' static self ) { // Static thread manager that will always be available trace ! ( " " ) ; ( 0 .. self . static_threads ) . for_each ( | _ | { let clone = Arc :: clone ( & self . runner ) ; thread :: Builder :: new ( ) . name ( " " . to_string ( ) ) . spawn ( move | | { Self :: affinity_pinner ( ) ; clone . run_static ( THREAD_PARK_TIMEOUT ) ; } ) . expect ( " " ) ; } ) ; // Dynamic thread manager that will allow us to unpark threads // According to the needs trace ! ( " " ) ; ( 0 .. self . dynamic_threads ) . for_each ( | _ | { let clone = Arc :: clone ( & self . runner ) ; thread :: Builder :: new ( ) . name ( " " . to_string ( ) ) . spawn ( move | | { Self :: affinity_pinner ( ) ; clone . run_dynamic ( & | | self . park_thread ( ) ) ; } ) . expect ( " " ) ; } ) ; // Pool manager to check frequency of task rates // and take action by scaling the pool accordingly. thread :: Builder :: new ( ) . name ( " " . to_string ( ) ) . spawn ( move | | { let poll_interval = Duration :: from_millis ( SCALER_POLL_INTERVAL ) ; trace ! ( " " ) ; loop { self . scale_pool ( ) ; thread :: park_timeout ( poll_interval ) ; } } ) . expect ( " " ) ; }
Initialize the dynamic pool
That will be scaled
Initialize the dynamic pool That will be scaled
&'static self