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

Ensure recursive rdlock()s don't deadlock.

parent f36ddb9f
No related branches found
No related tags found
No related merge requests found
Pipeline #5300 passed
......@@ -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