Better systrace logging and small improvements to JobSystem

Tweak how we signal/wakeup threads so we get better parallelism 
on Android.
This commit is contained in:
Mathias Agopian
2021-06-01 23:09:10 -07:00
committed by Mathias Agopian
parent 9a24c4001f
commit 4d73583f86
5 changed files with 14 additions and 1 deletions

View File

@@ -253,8 +253,13 @@ void JobSystem::wake() noexcept {
lock.lock();
// this empty critical section is needed -- it guarantees that notifiy_all() happens
// after the condition variables are set.
lock.unlock();
// We signal the condition inside the lock (which is not required), because this seems to
// yield to better scheduling on Android. When we signal outside the critical section,
// it looks like this thread gives its time slice to the waking thread and just sits there
// being runnable, but not running.
mWaiterCondition.notify_all();
lock.unlock();
}
inline JobSystem::ThreadState& JobSystem::getState() noexcept {