summaryrefslogtreecommitdiffstats
path: root/src/tools/qmutex_p.h
diff options
context:
space:
mode:
authorBobby Bingham <[email protected]>2023-03-27 22:07:16 -0500
committerMichele Calgaro <[email protected]>2023-05-23 12:28:54 +0900
commitc87fb38122777e1a54f67a0007d84edd6193e67b (patch)
treedf7b916f6be7c3c5f6044a70a3cb6b572a0c1744 /src/tools/qmutex_p.h
parentd7c0502bf99749e91ae87298434bbb244f0b5f8a (diff)
downloadtqt3-c87fb38122777e1a54f67a0007d84edd6193e67b.tar.gz
tqt3-c87fb38122777e1a54f67a0007d84edd6193e67b.zip
Fix level when using pthreads recursive mutex
When using the pthreads recursive mutex, the level method was only able to return either zero or one, but a recursive mutex can be locked more than once. Additionally, the way this detected if the mutex was already locked was to test whether it can be locked again. If testing from the thread that is currently holding the lock, this locking attempt always succeeds, and therefore determines that the lock is _not_ held at all. This is especially bad, as this operation only makes sense to perform from the thread that holds the lock -- if any thread not holding the lock queries the number of times the lock is held, that answer can change before the thread can used it. Signed-off-by: Bobby Bingham <[email protected]> (cherry picked from commit 999cebcb5df0269d24d65db579a7c78a94053c2e)
Diffstat (limited to 'src/tools/qmutex_p.h')
0 files changed, 0 insertions, 0 deletions