diff options
author | kpayson64 <kpayson@google.com> | 2016-10-17 13:12:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-17 13:12:22 -0700 |
commit | 872559593329f1a6903d0b41f669eb4ba719dbe8 (patch) | |
tree | d081c92bdd4abfa22260f2a72bf2d5af59c83b2f /src/core/lib/iomgr/wakeup_fd_pipe.c | |
parent | f04942592a6d8c31bb78fea634ae6a1b030f1c80 (diff) | |
parent | 97e6920e44a19718099d7670b1e3fb0076f4de45 (diff) |
Merge pull request #7664 from kpayson64/cv_wakeup_fd
Add Shim for wakeup_fds with no pipe or
Diffstat (limited to 'src/core/lib/iomgr/wakeup_fd_pipe.c')
-rw-r--r-- | src/core/lib/iomgr/wakeup_fd_pipe.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.c b/src/core/lib/iomgr/wakeup_fd_pipe.c index 4e5dbdcb73..d0ea216aa0 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.c +++ b/src/core/lib/iomgr/wakeup_fd_pipe.c @@ -47,11 +47,10 @@ static grpc_error* pipe_init(grpc_wakeup_fd* fd_info) { int pipefd[2]; - /* TODO(klempner): Make this nonfatal */ int r = pipe(pipefd); if (0 != r) { gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, strerror(errno)); - abort(); + return GRPC_OS_ERROR(errno, "pipe"); } grpc_error* err; err = grpc_set_socket_nonblocking(pipefd[0], 1); @@ -95,8 +94,13 @@ static void pipe_destroy(grpc_wakeup_fd* fd_info) { } static int pipe_check_availability(void) { - /* Assume that pipes are always available. */ - return 1; + grpc_wakeup_fd fd; + if (pipe_init(&fd) == GRPC_ERROR_NONE) { + pipe_destroy(&fd); + return 1; + } else { + return 0; + } } const grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable = { |