[Gc] patch to handle EINTR

Boehm, Hans hans.boehm at hp.com
Tue Jan 18 17:03:03 PST 2005


Thanks.

I actually already had a more verbose version of this in the gc7 tree.
I put your version into the gc6.5 tree.

Is this actually supposed to happen somewhere?  I observed this on Linux
when running under gdb.  But the sem_wait documentation on Linux very
explicitly states that this can't happen.  Hence the current code
complains before ignoring it.

Hans



> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com]On Behalf Of Paolo Molaro
> Sent: Tuesday, January 18, 2005 2:29 AM
> To: Gc at napali.hpl.hp.com
> Subject: [Gc] patch to handle EINTR
> 
> 
> Just a small patch to handle EINTR when calling sem_wait ().
> 
> lupus
> 
> Index: pthread_stop_world.c
> ===================================================================
> --- pthread_stop_world.c	(revision 39018)
> +++ pthread_stop_world.c	(working copy)
> @@ -366,9 +366,11 @@
>  	  }
>        }
>      for (i = 0; i < n_live_threads; i++) {
> -	  if (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
> -	      GC_err_printf1("Sem_wait returned %ld\n", 
> (unsigned long)code);
> -	      ABORT("sem_wait for handler failed");
> +	  while (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
> +	      if (errno != EINTR) {
> +	         GC_err_printf1("Sem_wait returned %ld\n", 
> (unsigned long)code);
> +	         ABORT("sem_wait for handler failed");
> +	      }
>  	  }
>      }
>      #if DEBUG_THREADS
> -- 
> -----------------------------------------------------------------
> lupus at debian.org                                     debian/rules
> lupus at ximian.com                             Monkeys do it better
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 


More information about the Gc mailing list