(&self, sleeping: u32)
| 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 |
no test coverage detected