File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1919#include < algorithm>
2020#include < atomic>
2121#include < condition_variable>
22+ #include < fcntl.h>
2223#include < mutex>
24+ #include < sys/select.h>
2325#include < thread>
2426#include < unistd.h>
2527#include < vector>
2628
27- #include " fcntl.h"
2829#include " log.h"
29- #include " sys/select.h"
3030
3131#ifndef TEMP_FAILURE_RETRY
3232/* Used to retry syscalls that can return EINTR. */
@@ -167,13 +167,23 @@ class AsyncManager::AsyncFdWatcher {
167167 }
168168 // set up the communication channel
169169 int pipe_fds[2 ];
170- if (pipe2 (pipe_fds, O_NONBLOCK )) {
170+ if (pipe (pipe_fds)) {
171171 ERROR (
172172 " {}: Unable to establish a communication channel to the reading "
173173 " thread" ,
174174 __func__);
175175 return -1 ;
176176 }
177+ // configure the fds as non blocking.
178+ if (fcntl (pipe_fds[0 ], F_SETFL, O_NONBLOCK) ||
179+ fcntl (pipe_fds[1 ], F_SETFL, O_NONBLOCK)) {
180+ ERROR (
181+ " {}: Unable to configure the communication channel to the reading "
182+ " thread" ,
183+ __func__);
184+ return -1 ;
185+ }
186+
177187 notification_listen_fd_ = pipe_fds[0 ];
178188 notification_write_fd_ = pipe_fds[1 ];
179189
You can’t perform that action at this time.
0 commit comments