(&'static self, func: F)
| 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(¤t_size) { |
| 383 | // The size remained the same |
no test coverage detected