diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-30 04:39:26 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-30 04:39:26 +0100 |
commit | e712a6eea96d381d2f1e3c0f8328d870321b31de (patch) | |
tree | 2df5a79fb5d3b219f0fbeae68c41332608e98661 /tracker-aruco/images | |
parent | 07ef302c354369ffdecf7016207a01097c3cdc59 (diff) |
compat: prevent deadlock with race
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.
Diffstat (limited to 'tracker-aruco/images')
0 files changed, 0 insertions, 0 deletions