MCPcopy Create free account
hub / github.com/NthTensor/Forte / get_worker

Method get_worker

src/thread_pool.rs:370–380  ·  view source on GitHub ↗
(&'static self, func: F)

Source from the content-addressed store, hash-verified

368 pub fn resize<F>(&'static self, get_size: F) -> usize
369 where
370 F: Fn(usize) -> usize,
371 {
372 // Resizing a pool is a critical section; only one thread can resize the
373 // pool at a time. This is implemented using a mutex on the thread manager.
374 let mut managed_workers = self.managed_workers.lock().unwrap();
375
376 // Compute the new size of the pool, given the current size.
377 let current_size = managed_workers.len();
378
379 // Calculate the new size of the pool (counting only managed workers).
380 let new_size = get_size(current_size);
381
382 match new_size.cmp(&current_size) {
383 // The size remained the same

Callers 2

with_workerMethod · 0.80
block_onMethod · 0.80

Calls 1

idMethod · 0.45

Tested by

no test coverage detected