summaryrefslogtreecommitdiffstats
path: root/src/pipeline/dispatch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipeline/dispatch.rs')
-rw-r--r--src/pipeline/dispatch.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pipeline/dispatch.rs b/src/pipeline/dispatch.rs
index aea934e..35fe646 100644
--- a/src/pipeline/dispatch.rs
+++ b/src/pipeline/dispatch.rs
@@ -9,7 +9,12 @@ use crate::db::{self, builds, Db};
use crate::pipeline::{self, Outcome};
pub struct Pool {
+ // Read only by `shutdown`, which is compiled for the test tier: a release
+ // build starts the dispatcher and runs it until the process exits, so in
+ // that build these two fields are stored and never read.
+ #[cfg_attr(not(feature = "test-support"), allow(dead_code))]
stop: Arc<AtomicBool>,
+ #[cfg_attr(not(feature = "test-support"), allow(dead_code))]
handles: Vec<JoinHandle<()>>,
}
@@ -47,6 +52,12 @@ impl Pool {
Pool { stop, handles }
}
+ /// Stop the dispatcher threads and join them.
+ ///
+ /// Production runs the pool until the process exits; nothing asks it to
+ /// stop. A test needs the join, because it asserts on the pool's effects
+ /// and cannot do that while the threads are still running.
+ #[cfg(feature = "test-support")]
pub fn shutdown(self) {
self.stop.store(true, Ordering::SeqCst);
for h in self.handles {