|
We can't depend on cvar getting notified only after "src" runs out of
scope.
Now, in case signal destroyed() runs first:
- mtx locked
- flag set to true
- empty cvar notified
Thus, doesn't hang.
In case we wait first:
- mtx locked
- flag is false
- cvar notification arrives
Of course semaphore code always runs serially since they're covered by a
mutex. We have all our bases covered.
Previously the code never hung simply because the "curthread" condition
was always true.
I removed the "curthread" code paths since they don't add anything. Also
rvalue references got used incorrectly.
|