This is either kernel or libc bug. When calling pthread_cancel() or by telling the other thread to call pthread_exit(). A to-be-stopped thread almost always raises (stacktrace leads to libc) SIGABRT when pthread_testcancelstate() or pthread_exit() is called. This is delivered to a main thread and causes program crash. This seems to be linux 2.6.* specific. I have tested this in 2.6.5, 2.6.6-rc3 (SIGABRT) and 2.4.26 (no SIGABRT). This also seems to be hard to work around. Setting signal blocking and/or signal handlers in a main thread and/or in a to-be-killed thread doesn't help so I have to switch back to 2.4.* kernels until this gets fixed. System: Debian linux 2.6.5/linux 2.6.6-rc3/linux 2.4.26 libc 2.3.2.ds1-12 gcc 3.3.3 (Debian prerelease 20040429)
Can you attach a testcase? Also, can you reproduce with more recent glibc, 2.3.2 is way to old. Particularly, aren't you calling these functions from C++ and lack: 2003-04-18 Ulrich Drepper <drepper@redhat.com> * sysdeps/pthread/pthread.h: Don't mark pthread_testcancel, pthread_cancel, pthread_setcancelstate, and pthread_setcanceltype with __THROW. 2003-12-26 Jakub Jelinek <jakub@redhat.com> * sysdeps/pthread/pthread.h (pthread_setcancelstate, pthread_setcanceltype, pthread_cancel, pthread_testcancel): Remove __THROW. * semaphore.h (sem_wait, sem_timedwait): Likewise. changes in pthread.h (depending if you build against linuxthreads or NPTL headers)?
No reply in almost two months. Closing.