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

Method with_current

src/thread_pool.rs:1204–1228  ·  view source on GitHub ↗
(f: F)

Source from the content-addressed store, hash-verified

1202 loop {
1203 if worker.yield_local() == Yield::Idle {
1204 // Attempt to submit our resignation
1205 let mut resignations =
1206 worker.thread_pool.resignations.load(Ordering::Relaxed);
1207 if resignations & REJECTION_MASK == 0 {
1208 match worker.thread_pool.resignations.compare_exchange(
1209 resignations,
1210 resignations + (1 << 26),
1211 Ordering::Relaxed,
1212 Ordering::Relaxed,
1213 ) {
1214 // Resignation accepted
1215 Ok(_) => break,
1216 // Resignation rejected due to ongoing broadcast
1217 Err(err) if err & REJECTION_MASK != 0 => worker.wait(),
1218 // Resignation conflicted with other worker, try again
1219 Err(err) => resignations = err,
1220 }
1221 }
1222 }
1223 }
1224
1225 worker
1226 .thread_pool
1227 .wants_to_resign
1228 .fetch_and(!(1 << worker.member_index), Ordering::Relaxed);
1229
1230 // Drop the worker, which will also free the claimed membership.
1231 let thread_pool = worker.thread_pool;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected