Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Terminating a thread from the parent
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Peter Hansen, post: 1821008"] join() waits until the thread terminates, but it doesn't cause it to terminate. You have to poll for a termination request in the thread's main loop, and have the thread terminate itself (by returning from the target function or from the run() method, depending on which technique you used to create the Thread in the first place). Threads cannot be forcibly terminated**. There are numerous examples of this in the archives and probably a Cookbook recipe or two about it, if you look. Otherwise someone can post an example here. -Peter ** The exception is Threads on which .setDaemon(True) has been called, which will terminate immediately when the main thread exits (i.e. when the entire process terminates), though that might not be helpful to you in your particular situation. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Terminating a thread from the parent
Top