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

Side by Side Diff: tools/android/forwarder2/pipe_notifier.h

Issue 148113003: forwarder2: Make the Forwarder instances operate on a single thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address David's comment Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « tools/android/forwarder2/host_controller.h ('k') | tools/android/forwarder2/pipe_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_ 5 #ifndef TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_
6 #define TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_ 6 #define TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 9
10 namespace forwarder2 { 10 namespace forwarder2 {
11 11
12 // Helper class used to create a unix pipe that sends notifications to the 12 // Helper class used to create a unix pipe that sends notifications to the
13 // |receiver_fd_| file descriptor when called |Notify()|. This should be used 13 // |receiver_fd_| file descriptor when called |Notify()|. This should be used
14 // by the main thread to notify other threads that it must exit. 14 // by the main thread to notify other threads that it must exit.
15 // The |receiver_fd_| can be put into a fd_set and used in a select together 15 // The |receiver_fd_| can be put into a fd_set and used in a select together
16 // with a socket waiting to accept or read. 16 // with a socket waiting to accept or read.
17 class PipeNotifier { 17 class PipeNotifier {
18 public: 18 public:
19 PipeNotifier(); 19 PipeNotifier();
20 ~PipeNotifier(); 20 ~PipeNotifier();
21 21
22 bool Notify(); 22 bool Notify();
23 23
24 int receiver_fd() const { return receiver_fd_; } 24 int receiver_fd() const { return receiver_fd_; }
25 25
26 void Reset();
27
26 private: 28 private:
27 int sender_fd_; 29 int sender_fd_;
28 int receiver_fd_; 30 int receiver_fd_;
29 31
30 DISALLOW_COPY_AND_ASSIGN(PipeNotifier); 32 DISALLOW_COPY_AND_ASSIGN(PipeNotifier);
31 }; 33 };
32 34
33 } // namespace forwarder 35 } // namespace forwarder
34 36
35 #endif // TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_ 37 #endif // TOOLS_ANDROID_FORWARDER2_PIPE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « tools/android/forwarder2/host_controller.h ('k') | tools/android/forwarder2/pipe_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698