Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3730)

Unified Diff: base/synchronization/waitable_event_win.cc

Issue 10151009: Disallow UI/IO thread blocking on any other thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/synchronization/waitable_event_posix.cc ('k') | base/test/thread_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/waitable_event_win.cc
===================================================================
--- base/synchronization/waitable_event_win.cc (revision 133458)
+++ base/synchronization/waitable_event_win.cc (working copy)
@@ -8,6 +8,7 @@
#include <windows.h>
#include "base/logging.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
namespace base {
@@ -47,6 +48,7 @@
}
void WaitableEvent::Wait() {
+ base::ThreadRestrictions::AssertWaitAllowed();
DWORD result = WaitForSingleObject(handle_, INFINITE);
// It is most unexpected that this should ever fail. Help consumers learn
// about it if it should ever fail.
@@ -54,6 +56,7 @@
}
bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
+ base::ThreadRestrictions::AssertWaitAllowed();
DCHECK(max_time >= TimeDelta::FromMicroseconds(0));
// Be careful here. TimeDelta has a precision of microseconds, but this API
// is in milliseconds. If there are 5.5ms left, should the delay be 5 or 6?
@@ -74,6 +77,7 @@
// static
size_t WaitableEvent::WaitMany(WaitableEvent** events, size_t count) {
+ base::ThreadRestrictions::AssertWaitAllowed();
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
CHECK_LE(count, MAXIMUM_WAIT_OBJECTS)
<< "Can only wait on " << MAXIMUM_WAIT_OBJECTS << " with WaitMany";
« no previous file with comments | « base/synchronization/waitable_event_posix.cc ('k') | base/test/thread_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698