mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 15:29:05 +00:00
Use non-blocking socket() and pipe() wrappers
Change-Id: I050ceffe5a133d5add2dab46687209813d58f597
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user