Mutex primitive for generator flow control.