Auxiliary thread: runs notifyLoop, notifyBool.exchange(true) returns false; writes character to pipe & sets notifyBool to true
Main thread: clears pipe
Now the pipe is clear, but notifyBool is true, meaning no notifyLoop call will do anything, and poll() will never respond.
My comment was technically correct as the events corresponding to notifyLoop calls between the poll & notifyBool clears will be processed, but I failed to consider what happens after that :/
Currently, the following can happen:
notifyBool.store(false);
notifyLoop
,notifyBool.exchange(true)
returns false; writes character to pipe & setsnotifyBool
to trueNow the pipe is clear, but
notifyBool
is true, meaning nonotifyLoop
call will do anything, andpoll()
will never respond.My comment was technically correct as the events corresponding to
notifyLoop
calls between the poll & notifyBool clears will be processed, but I failed to consider what happens after that :/