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

AvahiGLibPoll* avahi_glib_poll_new ( GMainContext *  context,
gint  priority 
)

Create a new GLib main loop adapter attached to the specified context. If context is NULL, the default main loop context is used. You can attach as many AvahiGLibPoll objects to the same context as you want. priority takes one of GLib's G_PRIORITY constants.

Definition at line 347 of file glib-watch.c.

References AVAHI_LLIST_HEAD_INIT.

                                                                         {
    AvahiGLibPoll *g;

    static GSourceFuncs source_funcs = {
        prepare_func,
        check_func,
        dispatch_func,
        NULL,
        NULL,
        NULL
    };

    g = (AvahiGLibPoll*) g_source_new(&source_funcs, sizeof(AvahiGLibPoll));
    g_main_context_ref(g->context = context ? context : g_main_context_default());

    g->api.userdata = g;

    g->api.watch_new = watch_new;
    g->api.watch_free = watch_free;
    g->api.watch_update = watch_update;
    g->api.watch_get_events = watch_get_events;

    g->api.timeout_new = timeout_new;
    g->api.timeout_free = timeout_free;
    g->api.timeout_update = timeout_update;

    g->watch_req_cleanup = FALSE;
    g->timeout_req_cleanup = FALSE;

    AVAHI_LLIST_HEAD_INIT(AvahiWatch, g->watches);
    AVAHI_LLIST_HEAD_INIT(AvahiTimeout, g->timeouts);

    g_source_attach(&g->source, g->context);
    g_source_set_priority(&g->source, priority);
    g_source_set_can_recurse(&g->source, FALSE);

    return g;
}


Generated by  Doxygen 1.6.0   Back to index