Skip to content
Snippets Groups Projects
Commit 6f5cf8b7 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Ensure recursive rdlock()s don't deadlock.

parent 45a1a992
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
......@@ -461,6 +461,15 @@ static void rwlock_rdlock_thread(void *arg)
printf("Obtained %d locks (should be 4)\n", locks);
for (; locks > 0; locks--) {
SLEEP(1000);
// Ensure recursion works when writers are waiting...
if (rwlock_rdlock(lock)) {
if (!rwlock_unlock(lock)) {
printf("Failed to unlock recursive rdlock #%d with write waiter\n", locks + 1);
}
}
else {
printf("Failed to lock recursive rdlock #%d with write waiter\n", locks + 1);
}
if (!rwlock_unlock(lock)) {
printf("Failed to unlock rdlock #%d\n", locks);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment