Re: how to generate glib events



On Sun, 01 Mar 2009 11:24:21 +0100
Mauro Condarelli <mc5686 mclink it> wrote:
> I am using glib (not full GTK+) for a server application that needs
> to listen to multiple sockets/pipes.
> I managed to have the GIOChannels working the way I need them.
> Now I have (in some of the GIOChannel watches) a complete message to
> be processed.
> In order to serialize processing I would like to avoid processing 
> directly in the watch callback, I would like to "queue" somehow the 
> message and have another "watch" in the main loop to wait on this
> queue. I can do this easily using polling and timeouts, but this
> would introduce unacceptable delays.
> I'm currently trying to implement this using a pipe and another 
> GIOChannel watching on it.
> Is this the right way to do such a thing?
> Is there another (better) way to do this.
> Can someone point me to the right documentation (possibly some
> tutorial)? Should I implement a new Source  (g_source_new() and all
> associated paraphernalia)?
> If so: where can I get some example?

g_idle_add() and g_idle_add_full() do this for you.

Chris


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