|
|
|
|
|
by yc12340
2550 days ago
|
|
> pthread cancellation was a terrible idea when it was added, and it's even worse today > you can implement it yourself via signals It appears, that you are contradicting yourself. Either it is "bad idea" or it is easy to correctly implement by oneself, not both. musl has well though-out implementation of pthread cancellation, so it is clearly doable, even if glibc developers have failed at it. |
|
It's easy to correctly implement the parts that aren't just adding a call to pthread_testcancel to every single syscall wrapper, just reserve an RT signal and do your thread teardown when you receive it, using pthread_sigmask to implement enable/disable. It's just that it's just a terrible idea.