The appended program works fine if you build it with "gcc cancel.c -pthread".
It creates a thread that blocks on stdin in a "pthread_cleanup_push()" context.
The main thread then cancels it, at which point the created thread calls the
cancel handler and returns. However, if you add "-fexceptions" (or,
equivalently, build the program with g++ instead of gcc) the cancellation
handler doesn't get called. This works fine on x86.
It's not clear if this is gcc or glibc bug, but I'm filing it as a glibc bug
for now, since there don't seem to be any similar failures in the gcc
This failure mode breaks the following glibc tests:
--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Thread cancellation on glibc requires gcc exception frame information provided
by PT_GNU_EH_FRAME and the compiler must instruct the linker to produce it by
--eh-frame-hdr. On you example you are linking the shared library using linker
command directly, using default options. If you use either gcc driver (gcc
-shared) or add --eh-frame-hdr on linker options the example does not fail.
You are receiving this mail because:
You are on the CC list for the bug.