Bug 1195767 - part 5 - use signaling instead of broadcast when work items are placed in nsEventQueue; r=gerald
authorNathan Froyd <froydnj@mozilla.com>
Thu, 03 Sep 2015 16:38:18 -0400
changeset 293858 9eaa5be9131856e1c1bc4c4af74ad531400910b0
parent 293857 3fcd5e172ea2dac9e2b7a9f11c3d6775ed5cf87b
child 293859 2a81ba282e1641eb0a1905cd789e5ce2af229bbb
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1195767
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1195767 - part 5 - use signaling instead of broadcast when work items are placed in nsEventQueue; r=gerald There's no reason to wake up all the threads in a thread pool when one item gets placed in the queue. Waking up one will serve the same purpose and is significantly more efficient for thread pools with large numbers of threads.
xpcom/threads/nsEventQueue.cpp
--- a/xpcom/threads/nsEventQueue.cpp
+++ b/xpcom/threads/nsEventQueue.cpp
@@ -127,17 +127,17 @@ nsEventQueueBase<MonitorType>::PutEvent(
     mOffsetTail = 0;
   }
 
   nsIRunnable*& queueLocation = mTail->mEvents[mOffsetTail];
   MOZ_ASSERT(!queueLocation);
   queueLocation = aRunnable.take();
   ++mOffsetTail;
   LOG(("EVENTQ(%p): notify\n", this));
-  aProofOfLock.NotifyAll();
+  aProofOfLock.Notify();
 }
 
 template void nsEventQueueBase<Monitor>::PutEvent(already_AddRefed<nsIRunnable>&& aRunnable,
                                                   MonitorAutoLock& aProofOfLock);
 template void nsEventQueueBase<ReentrantMonitor>::PutEvent(already_AddRefed<nsIRunnable>&& aRunnable,
                                                            ReentrantMonitorAutoEnter& aProofOfLock);
 
 void