From 3570ea8deedc9f0aff2663ba8276f1c7edfb5faf Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 12 Aug 2013 02:41:37 -0700 Subject: [PATCH] Fix condition variable misuse. --- Core/ThreadEventQueue.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/ThreadEventQueue.h b/Core/ThreadEventQueue.h index 5d0b6d9d51..55fddbcc0e 100644 --- a/Core/ThreadEventQueue.h +++ b/Core/ThreadEventQueue.h @@ -58,6 +58,7 @@ struct ThreadEventQueue : public B { } void RunEventsUntil(u64 globalticks) { + lock_guard guard(eventsWaitLock_); do { for (Event ev = GetNextEvent(); EventType(ev) != EVENT_INVALID; ev = GetNextEvent()) { switch (EventType(ev)) { @@ -89,6 +90,7 @@ struct ThreadEventQueue : public B { return; } + lock_guard guard(eventsDrainLock_); // While processing the last event, HasEvents() will be false even while not done. // So we schedule a nothing event and wait for that to finish. ScheduleEvent(EVENT_SYNC);