This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Libc thread cancelation safety?
* Dean Anderson:
> I have noticed that printf in glibc (glibc 2.3.5, i386) is not pthread
> cancellation safe, though printf on Solaris is cancellation safe.
> Specifically, canceling a thread in printf leads to deadlock.
>
> What should one expect regarding cancelation safety in standard
> libraries? Is this a bug in glibc?
Asynchronous cancellation is inherently unsafe. I can't find a full
list of functions which may be called from a thread which is subject
to asynchronous cancellation right now, but it is undoubtly very short
and does not include anything which touches the heap or uses the stdio
I/O facilities. Most bare system calls (read, write, close, pipe)
should be fine, though.