Re: How to make timeout I/O on GIOChannel



On Tue, 2006-07-11 at 16:49 +0700, Ady Wicaksono wrote:
> I want to make a timeout I/O on GIOChannel
> 
> Anybody has example for this?
> 
> How can i use select() or poll() on GIOChannel?

Well, you can use g_io_channel_unix_get_fd() to get the file descriptor
and then use select() or poll() with that, although I wouldn't recommend
it.

What is it exactly that you want to do? Typically if you just want to
wait a period of time for input on a file descriptor, you can just use
g_timeout_add() and when that expires do something. If you need to know
if you have had input in the time it takes for the timeout to expire,
you could simply set a flag in a GIOChannel callback, which can be set
up using e.g. g_io_add_watch (channel, G_IO_IN, my_callback, user_data).

It depends on what you really want to use the timeout for really.

-- 
Regards,
Martyn




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