Re: Reviving gweather



> Does gtk or gnome provide anny method for nonblocking i/o like select() or
> poll()? that fex. emits a signal every time there is something to read on
> the socket.

Check out the GIOChannel. It's exactly what you're looking for, and is
provided in glib.

http://developer.gnome.org/doc/API/glib/glib-io-channels.html

Essentially, you create a GIOChannel by using g_io_channel_unix_new() and
passing it the file descriptor. Then you put a watch on it which calls a
callback. Something like

g_io_add_watch(channel, G_IO_IN, my_read_func, user_data)

is what you'll want. G_IO_IN tells it to call the function whenever there
is data to read on the channel.

Joe





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