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

Method signal_random

src/thread_pool.rs:1333–1345  ·  view source on GitHub ↗
(&self, sleeping: u32)

Source from the content-addressed store, hash-verified

1331 // allocated within its own stack frame. Before it returns,
1332 // `activate` restores the previous value of `WORKER_PTR` (and it
1333 // aborts on panic, so this reset is guaranteed to occur). So the
1334 // `WORKER_PTR` is either null or a pointer to a live, immovable
1335 // `Worker`.
1336 //
1337 // If the pointer is non-null, it is therefore sound to dereference
1338 // as a shared reference. Forming a `'static` reference is avoided
1339 // by passing the value into a closure, which bounds the reference's
1340 // lifetime to the closure body and prevents callers from retaining
1341 // it past the point where `activate` returns and the `Worker` is
1342 // freed.
1343 Some(f(unsafe { &*worker_ptr }))
1344 } else {
1345 None
1346 }
1347 }
1348

Callers 1

promote_coldMethod · 0.80

Calls 2

next_usizeMethod · 0.80
signalMethod · 0.80

Tested by

no test coverage detected