Re: glib patch to handle EINTR in poll



On Tue, 7 Nov 2000, Elliot Lee wrote:

> ? obj
> ? update.log
> Index: gmain.c
> ===================================================================
> RCS file: /cvs/gnome/glib/gmain.c,v
> retrieving revision 1.42
> diff -u -r1.42 gmain.c
> --- gmain.c	2000/09/29 13:37:00	1.42
> +++ gmain.c	2000/11/08 00:42:50
> @@ -1049,15 +1049,25 @@
>    npoll = i;
>    if (npoll || timeout != 0)
>      {
> +      gboolean do_retry;
> +
>  #ifdef	G_MAIN_POLL_DEBUG
>        g_print ("g_main_poll(%d) timeout: %d\n", npoll, timeout);
>        poll_timer = g_timer_new ();
>  #endif
>        
>        G_UNLOCK (main_loop);
> -      if ((*poll_func) (fd_array, npoll, timeout) < 0)
> -	g_warning ("poll(2) failed due to: %s.",
> -		   g_strerror (errno));
> +      do {
> +	do_retry = FALSE;
> +	if ((*poll_func) (fd_array, npoll, timeout) < 0)
> +	  {
> +	    if(errno == EINTR)
> +	      do_retry = TRUE;
> +	    else
> +	      g_warning ("poll(2) failed due to: %s.",
> +			 g_strerror (errno));
> +	  }
> +      } while(do_retry);
>        G_LOCK (main_loop);
>        
>  #ifdef	G_MAIN_POLL_DEBUG

glib shouldn't retry polling if it got EINTR, that'd defeat
signal handlers setup in the application, instead it should
just do its normal dispatching work.

gtk-bugs is the wrong list to send such patches btw, we've got
gtk-devel-list for that purpose.

---
ciaoTJ





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