cheshirekow  v0.1.0
notify_pipe.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (josh.bialkowski@gmail.com)
3  *
4  * This file is part of cpp-nix.
5  *
6  * cpp-nix is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * cpp-nix is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with cpp-nix. If not, see <http://www.gnu.org/licenses/>.
18  */
27 #ifndef CPP_NIX_NOTIFYPIPE_H_
28 #define CPP_NIX_NOTIFYPIPE_H_
29 
30 namespace nix {
31 
35 class NotifyPipe {
36  private:
37  int m_fd[2];
38 
39  public:
41  NotifyPipe();
42 
44  ~NotifyPipe();
45 
47  int GetWriteFd();
48 
50  int GetReadFd();
51 
53  int Notify();
54 
56  int Clear();
57 };
58 
59 } // namespace nix
60 
61 #endif // NOTIFYPIPE_H_
int GetReadFd()
Return the file descriptor for the read end of the pipe.
NotifyPipe()
opens pipe
int Clear()
Read from the pipe until it's empty.
~NotifyPipe()
closes pipe
int Notify()
Write a single byte to the pipe to signal all listeners.
int GetWriteFd()
Return the file descriptor for the write end of the pipe.
Manages a pipe which can be used as a condition variable between two threads. This is in contrast to ...
Definition: notify_pipe.h:35