4fn main() {
5// spawn our task, this creates a new OS thread.
6let th = stoplight::spawn(|stop| {
7while !stop.load(Ordering::Relaxed) {}
842
9});
1011// stop() signals the thread to stop, and then join returns its return value.
12th.stop();
13assert_eq!(th.join().unwrap(), 42);
14}