Use non-blocking socket() and pipe() wrappers

Change-Id: I050ceffe5a133d5add2dab46687209813d58f597
This commit is contained in:
Sean Bright
2018-12-11 09:54:43 -05:00
parent 232a56d0af
commit b84fd37ef0
5 changed files with 12 additions and 27 deletions

View File

@@ -116,7 +116,6 @@ static struct {
static void *pthread_timer_open(void)
{
struct pthread_timer *timer;
int i;
if (!(timer = ao2_alloc(sizeof(*timer), pthread_timer_destructor))) {
errno = ENOMEM;
@@ -126,15 +125,11 @@ static void *pthread_timer_open(void)
timer->pipe[PIPE_READ] = timer->pipe[PIPE_WRITE] = -1;
timer->state = TIMER_STATE_IDLE;
if (pipe(timer->pipe)) {
if (ast_pipe_nonblock(timer->pipe)) {
ao2_ref(timer, -1);
return NULL;
}
for (i = 0; i < ARRAY_LEN(timer->pipe); ++i) {
ast_fd_set_flags(timer->pipe[i], O_NONBLOCK);
}
ao2_lock(pthread_timers);
if (!ao2_container_count(pthread_timers)) {
ast_mutex_lock(&timing_thread.lock);