@kimapr I'm going to assume if the code is this bad, they have no idea how to use pthread_cancel, which is highly unsafe unless you know how to use it. Safe use requires the thread that might be cancelled to be aware that it's a potential cancellation target, to disable/enable cancellation at appropriate times, and to install cleanup handlers that restore a consistent state when cancellation is acted upon.