mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-24 23:23:58 +00:00
Kernel: Fix bad assertion in Lock::unlock_if_locked()
We shouldn't assert if you call this on a Lock held by another Thread in the same Process. Instead, we should just not unlock.
This commit is contained in:
parent
58ceaebd5a
commit
b35ad5b523
Notes:
sideshowbarker
2024-07-19 12:06:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b35ad5b523e
1 changed files with 4 additions and 2 deletions
|
@ -49,11 +49,13 @@ bool Lock::unlock_if_locked()
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (CAS(&m_lock, 1, 0) == 0) {
|
if (CAS(&m_lock, 1, 0) == 0) {
|
||||||
if (m_level == 0) {
|
if (m_level == 0) {
|
||||||
memory_barrier();
|
|
||||||
m_lock = 0;
|
m_lock = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ASSERT(m_holder == current);
|
if (m_holder != current) {
|
||||||
|
m_lock = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ASSERT(m_level);
|
ASSERT(m_level);
|
||||||
--m_level;
|
--m_level;
|
||||||
if (m_level) {
|
if (m_level) {
|
||||||
|
|
Loading…
Reference in a new issue