Changeset View
Changeset View
Standalone View
Standalone View
src/rcu.cpp
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | void RCUInfos::synchronize() { | ||||
} | } | ||||
// It seems like we have some contention. Let's try to not starve the | // It seems like we have some contention. Let's try to not starve the | ||||
// system. Let's make sure threads that land here proceed one by one. | // system. Let's make sure threads that land here proceed one by one. | ||||
// XXX: The best option long term is most likely to use a futex on one of | // XXX: The best option long term is most likely to use a futex on one of | ||||
// the thread causing synchronization delay so this thread can be waked up | // the thread causing synchronization delay so this thread can be waked up | ||||
// at an apropriate time. | // at an apropriate time. | ||||
static std::condition_variable cond; | static std::condition_variable cond; | ||||
static CWaitableCriticalSection cs; | static Mutex cs; | ||||
WAIT_LOCK(cs, lock); | WAIT_LOCK(cs, lock); | ||||
do { | do { | ||||
runCleanups(); | runCleanups(); | ||||
cond.notify_one(); | cond.notify_one(); | ||||
} while (!cond.wait_for(lock, std::chrono::microseconds(1), [&] { | } while (!cond.wait_for(lock, std::chrono::microseconds(1), [&] { | ||||
return cleanups.empty() && hasSyncedTo(syncRev); | return cleanups.empty() && hasSyncedTo(syncRev); | ||||
})); | })); | ||||
Show All 39 Lines |