aboutsummaryrefslogtreecommitdiff
path: root/src/self_pipe.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/self_pipe.cc')
-rw-r--r--src/self_pipe.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/self_pipe.cc b/src/self_pipe.cc
new file mode 100644
index 0000000..42e61d8
--- /dev/null
+++ b/src/self_pipe.cc
@@ -0,0 +1,21 @@
+#include "pipe.h"
+
+#include <unistd.h>
+#include <cstdlib>
+#include <fcntl.h>
+
+#include "error.h"
+
+namespace ov4
+{
+
+void self_pipe_init()
+{
+ int ret = pipe2(self_pipe_fd, O_NONBLOCK);
+ if (ret != 0)
+ {
+ throw T_error(error_code::FAIL_TO_OPEN_PIPE, "Fail to open self pipe");
+ }
+}
+
+} \ No newline at end of file