Ensures that there is at least one worker thread attached to the thread pool. This is mostly used to avoid deadlocks. This should be called before blocking on a thread pool to ensure the block will eventually be released. Returns the new size of the pool, which will be either the old size or one. See [`ThreadPool::resize_to`] for more information about resizing.
(&'static self)
| 266 | /// |
| 267 | /// Note: Workers only take work from this queue as a last resort, after all |
| 268 | /// their other work has been exhausted. |
| 269 | #[inline(always)] |
| 270 | pub fn push_shared_job(&'static self, job_ref: JobRef) { |
| 271 | self.shared_queue.push(job_ref); |
| 272 | // Try to wake up a worker to execute this job. This is relatively cheap |
| 273 | // if no workers are waiting. |
| 274 | let waiting_bitmask = self.waiting_bitmask.load(Ordering::Relaxed); |
| 275 | if waiting_bitmask != 0 { |
| 276 | let i = waiting_bitmask.trailing_zeros() as usize; |
| 277 | self.get_member_data().semaphores[i].signal(); |