A
A
alex-bul2019-05-19 00:50:09
Python
alex-bul, 2019-05-19 00:50:09

How to stop a thread in python by its name?

In general, the whole essence of the question lies in the title. I have the name of a specific thread that is already running. How can I stop him by name? Or how, in principle, to refer to a thread by its name? Help me please!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-05-19
@sergey-gornostaev

A thread must manage its own lifecycle on its own. Another thread can only send signals to it, changing the general state - a variable, a queue, or some of the synchronization primitives.

D
Dmitry Shitskov, 2019-05-19
@Zarom

There is no standard mechanism. You will have to implement some sort of mechanism to control your flow.
As a variant - to transfer to a flow its individual Boolean variable. Continuously check a variable in a stream. As soon as its state changes, terminate the thread.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question