This is the mail archive of the libc-alpha@sourceware.org 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


On Dec 22, 2014, MaShimiao <mashimiao.fnst@cn.fujitsu.com> wrote:

> 2. if funciont __sleep blocks SIGCHLD, no matter nanosleep() is cancelled or
> not, __seleep will restore the original signal mask before return.

If the thread is canceled, we won't take the normal execution path after
the nanosleep call; we'll only run cleanup handlers set up earlier in
the call chain, until the thread is terminated.

You may want to try it yourself: install a cleanup handler that probes
SIGCHLD in the signal mask, in a thread that calls sleep, and then
cancel the thread while sleep is running.  You shouldn't see SIGCHLD
blocked in your cleanup handler, but without the proposed patch, you
will.

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


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