Re: Data available for reading in a GIOChannel



On Tue, 29 May 2007, Jonathan Winterflood <jonathan winterflood gmail com> wrote :

A question arises, though: is it possible that the channel will recieve the last of the data between the time  g_io_channel_read_chars  returns G_IO_STATUS_AGAIN and the callbac
k exits, and that the callback will not be called again?

I don't think so, but given that somebody posted "from experience" that the callback is reentrant (which I didn't think was possible) perhaps I'm wrong. On the other hand, I've written code that assumes both non-reentrant and that any extra data arriving during the callback will result in it being called again, and I've never hit a problem.

My understanding was that the Glib idle task checks the IO channel status and calls the callback if it's ready. Since Glib is non-threaded, this cannot happen during a previous execution of the callback. And since it uses the channel's state rather than any edge events, no data will be lost or ignored simply because the callback was running at the time it arrived. Indeed this must be true if Glib is non-threaded, because the data may arrive at any time and some huge Gtk re-draw may be in progress when it happens. But that's only my understanding as a user so I'd advise you all to ask one of the authors.
--
Rob Pearce                       http://www.bdt-home.demon.co.uk

The contents of this | Windows NT crashed.
message are purely   | I am the Blue Screen of Death.
my opinion. Don't    | No one hears your screams.
believe a word.      |



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