Add some thread pool docs (#421)

This commit is contained in:
Carl Lerche
2018-06-15 15:20:25 -07:00
committed by GitHub
parent 71c8f561e3
commit 3fac7ce68c
4 changed files with 147 additions and 4 deletions
+8 -2
View File
@@ -29,10 +29,16 @@ use std::thread;
use rand::{Rng, SeedableRng, XorShiftRng};
// TODO: Rename this
#[derive(Debug)]
pub(crate) struct Pool {
// ThreadPool state
// Tracks the state of the thread pool (running, shutting down, ...).
//
// While workers check this field as a hint to detect shutdown, it is
// **not** used as a primary point of coordination for workers. The sleep
// stack is used as the primary point of coordination for workers.
//
// The value of this atomic is deserialized into a `pool::State` instance.
// See comments for that type.
pub state: AtomicUsize,
// Stack tracking sleeping workers.