summaryrefslogtreecommitdiffstats
path: root/base/waitable_event_watcher.h
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 17:08:41 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 17:08:41 +0000
commit3fa48b283832b629486b17d638de01354c1bd74c (patch)
tree45d9d22aeb6b3f33e2b9b833bbef2662660adaca /base/waitable_event_watcher.h
parent7ae235bdb0b31b6b1b52a2db7e29cb7ce599f927 (diff)
downloadchromium_src-3fa48b283832b629486b17d638de01354c1bd74c.zip
chromium_src-3fa48b283832b629486b17d638de01354c1bd74c.tar.gz
chromium_src-3fa48b283832b629486b17d638de01354c1bd74c.tar.bz2
POSIX: allow WaitableEvents to be deleted while watching them.
On Windows, one can close a HANDLE which is currently being waited on. The MSDN documentation says that the resulting behaviour is 'undefined', but it doesn't crash. Currently, on POSIX, one couldn't use WaitableEventWatcher to watch an event which gets deleted. This mismatch has bitten us several times now. This patch allows WaitableEvents to be deleted while a WaitableEventWatcher is still watching them. It applies only to watchers, the usual Wait() and WaitMany() calls still require that all their target be valid until the end of the call. http://crbug.com/8809 Review URL: http://codereview.chromium.org/53026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/waitable_event_watcher.h')
-rw-r--r--base/waitable_event_watcher.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/base/waitable_event_watcher.h b/base/waitable_event_watcher.h
index 1b49944..94c3fdb 100644
--- a/base/waitable_event_watcher.h
+++ b/base/waitable_event_watcher.h
@@ -11,11 +11,11 @@
#include "base/object_watcher.h"
#else
#include "base/message_loop.h"
+#include "base/waitable_event.h"
#endif
namespace base {
-class WaitableEvent;
class Flag;
class AsyncWaiter;
class AsyncCallbackTask;
@@ -51,6 +51,9 @@ class AsyncCallbackTask;
// occurs just before a WaitableEventWatcher is deleted. There is currently no
// safe way to stop watching an automatic reset WaitableEvent without possibly
// missing a signal.
+//
+// NOTE: you /are/ allowed to delete the WaitableEvent while still waiting on
+// it with a Watcher. It will act as if the event was never signaled.
// -----------------------------------------------------------------------------
class WaitableEventWatcher
@@ -140,6 +143,7 @@ class WaitableEventWatcher
scoped_refptr<Flag> cancel_flag_;
AsyncWaiter* waiter_;
AsyncCallbackTask* callback_task_;
+ scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_;
#endif
};