mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 955888. Part 2: In chaos mode, sometimes yield just before dispatching an XPCOM event. r=bsmedberg
This gives other threads a chance to beat us in a race to dispatch an event to this event queue. --HG-- extra : rebase_source : ca19bb52281837762bce43481b3393cd2ecf6679
This commit is contained in:
parent
e6993f791e
commit
a22a728d85
@ -8,6 +8,8 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "prlog.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "prthread.h"
|
||||
#include "mozilla/ChaosMode.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -85,6 +87,14 @@ nsEventQueue::PutEvent(nsIRunnable *runnable)
|
||||
nsRefPtr<nsIRunnable> event(runnable);
|
||||
bool rv = true;
|
||||
{
|
||||
if (ChaosMode::isActive()) {
|
||||
// With probability 0.5, yield so other threads have a chance to
|
||||
// dispatch events to this queue first.
|
||||
if (ChaosMode::randomUint32LessThan(2)) {
|
||||
PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
|
||||
if (!mHead) {
|
||||
|
Loading…
Reference in New Issue
Block a user