Hi! Using pthread_cleanup_push() it is possible to register a cleanup routine which will get called upon thread cancellation. I have a hard time to understand what exactly this routine allowed to do and what not. The manpage states: "A clean-up handler is a function that is automatically executed when a thread is canceled (or in various other circumstances described below); it might, for example, unlock a mutex so that it becomes available to other threads in the process." https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cleanup_push.html even has an example with pthread_mutex_unlock() in the cleanup function. But NPTL implements thread cancellation with signals, if I'm not completely mistaken the cleanup routine will run in signal context then. So only async-signal-safe functions are good to use. pthread_mutex_unlock() is not. With my (limited) understanding of the current NPTL implementation I'd say a cleanup routine might only use async-signal-safe functions, except long jumps. Can you please clarify? And can we please state this more precisely in the manpage? -- Thanks, //richard