kernel/condition_variable: Pause between iterations.

Should hopefully resolve the remaining problem in #17455.

Change-Id: I6e00286508c069705e07c9a0b59af2cf5e15e427
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4819
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Augustin Cavalier
2021-12-18 07:52:47 +00:00
committed by Jérôme Duval
parent 101dc0ba83
commit e0842c10af
+3 -1
View File
@@ -157,8 +157,9 @@ ConditionVariableEntry::_RemoveFromVariable()
int32 tries = 0;
while (atomic_pointer_get(&fVariable) != NULL) {
tries++;
if ((tries % 100000) == 0)
if ((tries % 10000) == 0)
panic("variable pointer was not unset for a long time!");
cpu_pause();
}
return;
@@ -396,6 +397,7 @@ ConditionVariable::_NotifyLocked(bool all, status_t result)
tries++;
if ((tries % 10000) == 0)
panic("entries count was not decremented for a long time!");
cpu_pause();
}
} else {
status_t waitStatus = atomic_get_and_set(&entry->fWaitStatus, result);