Logo Search packages:      
Sourcecode: pulseaudio version File versions  Download package

pa_mainloop* pa_mainloop_new ( void   ) 

Allocate a new main loop object

Definition at line 448 of file mainloop.c.

References pa_xnew.

                                   {
    pa_mainloop *m;

    m = pa_xnew(pa_mainloop, 1);

    m->wakeup_pipe_type = 0;
    if (pipe(m->wakeup_pipe) < 0) {
        pa_log_error("ERROR: cannot create wakeup pipe");
        pa_xfree(m);
        return NULL;
    }

    pa_make_fd_nonblock(m->wakeup_pipe[0]);
    pa_make_fd_nonblock(m->wakeup_pipe[1]);
    pa_make_fd_cloexec(m->wakeup_pipe[0]);
    pa_make_fd_cloexec(m->wakeup_pipe[1]);
    m->wakeup_requested = 0;

    PA_LLIST_HEAD_INIT(pa_io_event, m->io_events);
    PA_LLIST_HEAD_INIT(pa_time_event, m->time_events);
    PA_LLIST_HEAD_INIT(pa_defer_event, m->defer_events);

    m->n_enabled_defer_events = m->n_enabled_time_events = m->n_io_events = 0;
    m->io_events_please_scan = m->time_events_please_scan = m->defer_events_please_scan = 0;

    m->cached_next_time_event = NULL;
    m->prepared_timeout = 0;

    m->pollfds = NULL;
    m->max_pollfds = m->n_pollfds = 0;
    m->rebuild_pollfds = 1;

    m->quit = m->retval = 0;

    m->api = vtable;
    m->api.userdata = m;

    m->state = STATE_PASSIVE;

    m->poll_func = NULL;
    m->poll_func_userdata = NULL;
    m->poll_func_ret = -1;

    return m;
}


Generated by  Doxygen 1.6.0   Back to index