g_io_add_watch() callback called constantly



I'm using GIOChannel for two apps to communicate with
each other, mostly because glib/GTK code
cross-compiles so easily to Win32. 

With that goal, I use g_io_channel_new_file() (since
it looks like the most platform independent) with a
g_io_add_watch() callback. Then I just sit in
gtk_main(), and sure enough, my callback gets the data
I want. But the problem is that it also appears to get
called constantly, even when there is no data waiting
for g_io_channel_read_chars(). To the point where the
processor is pegged at 100%.

How can I do this such that the watch is only called
when there is data waiting?

Thanks!








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