g_io_channel_set_watch_condition



When doing IPC or networking programs, there are ofter file descriptors
that are to be polled always for reading, but for writing, only when there
is some data pending. I do not see elegant ways to do that.

It is possible to remove the read only watch, and add the read/write watch
when the buffer is filled, and do the contrary when it is emptied, but this
is lot of bookkeeping for nothing.

It may be possible to use two GIOChannels, and add/remove a write only
watch on the second, while there is always a read only watch on the first,
but it a bit wastful, and I do not know if it is possible to have the same
fd for two watchs.

It is possible to redefine watch functions using g_source_* (what I have
done yesterday).

Perharps a function like g_io_channel_set_watch_condition could be useful
for that.

PS : please excuse my poor English.




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