Re: GSource and file descriptors

Joel Becker <jlbec evilplan org> writes:

> On Fri, May 11, 2001 at 04:20:14PM -0400, Owen Taylor wrote:

> 	Right, I'll try that.
> 	On this and other subjects, I've been endeavouring to use the
> online docs for this sort of stuff.  The GSource documentation is pretty
> rough.  g_source_new and g_source_add_poll seemed pretty obvious for fd
> related work, but almost nowhere did they mention the need to attach the
> source to a certain GMainContext, let alone the g_source_attach
> function.  Nor did they mention g_io_channel_add_watch() the common
> case.

OK, thanks for the info. I'm not sure if I've ever really update
the GMain docs for GLib-2.0; certainly I haven't updated the overview.

> 	In addition, are there plans to add g_timeout and g_idle
> versions that accept a non-default GMainContext?  I'm aware that the
> default context is the common case, but that doesn't mean a user should
> have to go through all of the GSource rigamarole just to set a timeout
> in thread #2.

g_[timeout,idle]_add_[full] are just convenience functions.

  GSource *source =  g_time_source_new (100);

  g_source_set_callback (source, function, data, notify);
  g_source_attach (source, context);


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