|
Nothing -> void $ tryPutMVar trigger () |
There is a small chance trigger is lost:
- Thread executing action checks for trigger and finds nothing
- Another thread reads baton and finds nothing
- Thread 1 sets baton and exits action loop
- Thread 2 sets trigger and exists.
Result: trigger is set but no action thread is running
The solution:
Set trigger unconditionally before checking for baton.