On Tue, Nov 07, 2017 at 03:11:31PM +0800, Fam Zheng wrote: > On Mon, 11/06 17:46, Peter Xu wrote: > > +static GMainContext *monitor_io_context_get(void) > > +{ > > + return iothread_get_g_main_context(mon_global.mon_iothread); > > +} > > + > > +static void monitor_iothread_init(void) > > +{ > > + mon_global.mon_iothread = iothread_create("monitor_iothread", > > + &error_abort); > > + /* > > + * GContext in iothread is using lazy init - the first time we > > + * fetch the context we'll have that initialized. > > + */ > > + monitor_io_context_get(); > > Why do you need an eager init here?
I thought putting this line with IOThread creation will make it more clear that the IOThread is using GMainContext polling. I am not that strong to keep it, but I would prefer. -- Peter Xu