mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
yield a little more politely
This commit is contained in:
parent
e4b210d607
commit
1020b07b1e
@ -514,14 +514,12 @@ choose_next_context() {
|
|||||||
if (_ready.empty() && _next_ready.empty()) {
|
if (_ready.empty() && _next_ready.empty()) {
|
||||||
// All of our threads are currently sleeping. Therefore, wake
|
// All of our threads are currently sleeping. Therefore, wake
|
||||||
// the volunteer(s) immediately.
|
// the volunteer(s) immediately.
|
||||||
if (!_volunteers.empty()) {
|
wake_all_sleepers(_volunteers);
|
||||||
wake_all_sleepers(_volunteers);
|
|
||||||
|
|
||||||
} else {
|
// We should also yield the whole process now, to be polite to
|
||||||
// No volunteers. Sleep the whole process.
|
// the rest of the system.
|
||||||
system_yield();
|
system_yield();
|
||||||
now = get_current_time();
|
now = get_current_time();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
wake_sleepers(_sleeping, now);
|
wake_sleepers(_sleeping, now);
|
||||||
wake_sleepers(_volunteers, now);
|
wake_sleepers(_volunteers, now);
|
||||||
@ -560,6 +558,10 @@ choose_next_context() {
|
|||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Waking volunteers.\n";
|
<< "Waking volunteers.\n";
|
||||||
}
|
}
|
||||||
|
// We should yield the whole process now, to be polite to the
|
||||||
|
// rest of the system.
|
||||||
|
system_yield();
|
||||||
|
now = get_current_time();
|
||||||
wake_all_sleepers(_volunteers);
|
wake_all_sleepers(_volunteers);
|
||||||
wake_sleepers(_sleeping, now);
|
wake_sleepers(_sleeping, now);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user