Re: GChildWatchSource take three



On Fri, 2003-08-01 at 16:51, Alexis S. L. Carvalho wrote:

> > @@ -2328,6 +2384,16 @@ g_main_context_iterate (GMainContext *co
> [...]
> > +  main_context_about_to_poll = context;
> >    some_ready = g_main_context_prepare (context, &max_priority); 
> >    
> >    while ((nfds = g_main_context_query (context, max_priority, &timeout, fds, 
> > @@ -2344,7 +2410,8 @@ g_main_context_iterate (GMainContext *co
> >      timeout = 0;
> >    
> >    g_main_context_poll (context, timeout, max_priority, fds, nfds);
> > -  
> > +  main_context_about_to_poll = NULL;
> > +
> 
> A question:  isn't it possible for g_main_context_iterate to be called
> recursively while main_context_about_to_poll is non-null (i.e. isn't it
> necessary to save it's old value and restore it later)?

The main loop can only be recursed out of dispatch - it isn't
legal for prepare/query/check functions to recurse the main loop.

> > +static void
> > +g_child_watch_signal_handler (int signum)
> > +{
> [...]
> > +      if (main_context_about_to_poll)
> > +	{
> > +	  g_main_context_wakeup_unlocked (main_context_about_to_poll);
> > +	}
> 
> Another question:  besides what Owen said, when G_OS_WIN32 is #define'd,
> this function calls ReleaseSemaphore - is it safe to call it from a
> signal handler?  Then again, I don't know if this is also supposed to
> work on Windows...

I don't think this stuff is remotely right for Windows - it's highly
POSIX specific.

Regards,
					Owen





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