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 // Calculate the new size of the pool (counting only managed workers).
369 let new_size = get_size(current_size);
370
371 match new_size.cmp(&current_size) {
372 // The size remained the same
373 cmp::Ordering::Equal => current_size,
374 // The size increased
375 cmp::Ordering::Greater => {
376 // Spawn the new workers.
377 let memberships = self.try_enroll_many(new_size - current_size);
378 for membership in memberships {
379 let member_index = membership.member_index;
380 let halt = Arc::new(AtomicBool::new(false));
381 let worker_halt = halt.clone();
382 let handle = ThreadBuilder::new()
383 .name(format!("managed worker {member_index}"))

Callers 2

with_workerMethod · 0.80
block_onMethod · 0.80

Calls 1

idMethod · 0.45

Tested by

no test coverage detected