This is the mail archive of the
mailing list for the glibc project.
Re: question about which sleep is noted in manual
- From: MaShimiao <mashimiao dot fnst at cn dot fujitsu dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>, <codonell at redhat dot com>
- Date: Mon, 22 Dec 2014 10:53:53 +0800
- Subject: Re: question about which sleep is noted in manual
- Authentication-results: sourceware.org; auth=none
- References: <547ED48B dot 2060509 at cn dot fujitsu dot com> <oregs9zvl2 dot fsf at free dot home> <5487EAF0 dot 70305 at cn dot fujitsu dot com> <orfvcd7a7a dot fsf at free dot home>
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:
saved_errno = errno;
/* Restore the original signal mask. */
(void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
So, I think we don't need this change.
Did I miss something?
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)