Normally, Linux threads cannot be killed outside the main proces's scope, except by killing the main process itself, however, I need to do so.

I made a threaded program which needs to have a complete shared memory space with its parent. The second thread uses an external library thread to manage it's workload, however, finishing the other thread SOMETIMES causes a deadlock caused by a bug in the external library.

When this happens and the "main" thread detects it it may warn ANOTHER process which is listening in the computer, and can carry a kill -9 against the process and the thread, restarting everything. However, this looks dirty. It there a method in python thread.threading that acts like multiprocessing.Process.terminate(), effectively kiling the thread without waiting for proper cleanups?.

I'm asking this in unir/linux and not stackoverflow because I only care about Linux environment. Any better/cleaner workaround that the one I'm currently using would be appreciated.

BTW: The buggy component is some GStreammer library which causes a deadlock when you set GST.State to NULL

I know it's a bad design pattern, and as far as I know what I' asking is not possible by design, but I'm stuck with a buggy component I need to deal with.

Browse other questions tagged or ask your own question.