This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about which sleep is noted in manual

Hi Alexandre,

On 12/18/2014 02:18 PM, Alexandre Oliva wrote:
> /* We are going to use the `nanosleep' syscall of the kernel.  But the
> @@ -104,7 +102,7 @@ __sleep (unsigned int seconds)
>  	 have to do anything here.  */
>        if (oact.sa_handler == SIG_IGN)
>  	{
> -	  //__libc_cleanup_push (cl, &oset);
> +	  __libc_cleanup_push (cl, &oset);
>  	  /* We should leave SIGCHLD blocked.  */
>  	  while (1)
> @@ -121,7 +119,7 @@ __sleep (unsigned int seconds)
>  		}
>  	    }
> -	  //__libc_cleanup_pop (0);
> +	  __libc_cleanup_pop (0);
I think we do not need this change.
>From the original code, I get the following logic:
1. if function __sleep doesn't block SIGCHLDïthen it does nothing.
2. if funciont __sleep blocks SIGCHLD, no matter nanosleep() is cancelled or
not, __seleep will restore the original signal mask before return. detail as following:
	 //__libc_cleanup_pop (0);

          saved_errno = errno;
          /* Restore the original signal mask.  */
          (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
          __set_errno (saved_errno);

          goto out;
So, I think we don't need this change.
Did I miss something?

Best regards
Ma Shimiao
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]