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 <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Augustin Cavalier 2021-12-17 11:51:28 -05:00 committed by Jérôme Duval
parent 101dc0ba83
commit e0842c10af

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);