libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
selfpipe.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <promeki/namespace.h>
14
15PROMEKI_NAMESPACE_BEGIN
16
34class SelfPipe {
35 public:
44 SelfPipe();
45
47 ~SelfPipe();
48
49 SelfPipe(const SelfPipe &) = delete;
50 SelfPipe &operator=(const SelfPipe &) = delete;
51
53 bool isValid() const { return _readFd >= 0; }
54
56 int readFd() const { return _readFd; }
57
59 int writeFd() const { return _writeFd; }
60
68 void wake();
69
77 void drain();
78
79 private:
80 int _readFd = -1;
81 int _writeFd = -1;
82};
83
84PROMEKI_NAMESPACE_END
85
86#endif // PROMEKI_ENABLE_CORE