Re: g_main_loop and g_async_queue



On Mon, 5 Jan 2009 05:03:41 -0500
"Donny Viszneki" <donny viszneki gmail com> wrote:
> On Mon, Jan 5, 2009 at 4:56 AM, Chris Vine
> <chris cvine freeserve co uk> wrote:
> > On Mon, 5 Jan 2009 07:45:02 -0200
> > Cris <ternaryd gmail com> wrote:
> > g_idle_add(), or g_idle_add_full(), are intended for use for message
> > passing to the event loop of the main program thread.  They are
> > thread safe.
> 
> I think he wants low-latency delivery of the queue data (like a high
> priority event.) Will glib's "idle" callbacks be appropriate for this?

"idle" is a poor choice of name - it presumably comes from the fact that
the priority adopted by g_idle_add() is G_PRIORITY_DEFAULT_IDLE - but
you can set the priority in the queue with g_idle_add_full() to any of
the five defined priorities for the main loop, or indeed for any other
priority number you like. g_event_add() would have been a much better
name.

However, all callbacks executed by the main program loop have latency,
because they cannot be executed until control in the main thread returns
to the loop.  Thus, for example, timeout callbacks are only an
approximation.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]