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

Side by Side Diff: mojo/public/cpp/system/event.h

Issue 2033243003: Use Mojo pipes to signal sync IPC events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/system/BUILD.gn ('k') | mojo/public/cpp/system/event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_EVENT_H_
6 #define MOJO_PUBLIC_CPP_SYSTEM_EVENT_H_
7
8 #include "base/macros.h"
9 #include "mojo/public/cpp/system/message_pipe.h"
10
11 namespace mojo {
12
13 // An Event is a simple wrapper around a Mojo message pipe which supports common
14 // WaitableEvent-like methods of Signal() and Reset(). All public methods on
15 // this object are safe to call from any thread as long as the object is still
16 // alive.
17 class Event {
18 public:
19 Event();
yzshen1 2016/06/07 17:14:51 Please comment on the initial state, whether the s
Ken Rockot(use gerrit already) 2016/06/07 18:02:25 Done
20 ~Event();
21
22 // Gets a Handle that can be waited on for this Event. Waiting may be done
23 // synchronously via MojoWait (or indirectly via a wait set), or
24 // asynchronously using a Watcher. When the Event is signaled, this handle
25 // will have |MOJO_HANDLE_SIGNAL_READABLE| satisfied.
26 const Handle& GetHandle() const { return wait_handle_.get(); }
27
28 // Ensures that the Handle returned by |GetHandle()| has the
29 // |MOJO_HANDLE_SIGNAL_READABLE| signal satisfied.
30 void Signal();
31
32 // Ensures that the Handle returned by |GetHandle()| does NOT have the
33 // |MOJO_HANDLE_SIGNAL_READABLE| signal satisfied.
34 void Reset();
35
36 private:
37 ScopedMessagePipeHandle signal_handle_;
38 ScopedMessagePipeHandle wait_handle_;
39
40 DISALLOW_COPY_AND_ASSIGN(Event);
41 };
42
43 } // namespace mojo
44
45 #endif // MOJO_PUBLIC_CPP_SYSTEM_EVENT_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/BUILD.gn ('k') | mojo/public/cpp/system/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698