Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 authored Oct 8, 2024
1 parent 86b2d74 commit 8f01f3b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Python/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,7 @@ void
_PyRecursiveMutex_Unlock(_PyRecursiveMutex *m)
{
if (_PyRecursiveMutex_TryUnlock(m) < 0) {
Py_FatalError("unlocking a recursive mutex that is not owned by the"
" current thread");
Py_FatalError("cannot unlock un-acquired lock");
}
}

Expand All @@ -413,8 +412,10 @@ int _PyRecursiveMutex_TryUnlock(_PyRecursiveMutex *m)
return 0;
}
assert(m->level == 0);
if (_PyMutex_TryUnlock(&m->mutex) < 0){
return -1;
};
_Py_atomic_store_ullong_relaxed(&m->thread, 0);
PyMutex_Unlock(&m->mutex);
return 0;
}

Expand Down

0 comments on commit 8f01f3b

Please sign in to comment.