4 ms·
The "politely ask it to stop" paradigm is not a solution. For it to work, your thread cannot perform any blocking calls, nor can it call out to any long running
by oconnore 15y ago
The "politely ask it to stop" paradigm is not a solution. For it to work, your thread cannot perform any blocking calls, nor can it call out to any long running functions that are not specifically designed to check a stop flag frequently.
- koenigdavidmj 15y agoYou can use os.pipe or socket.socketpair. That at least allows you to use blocking select, poll, or similar.
- eliben 15y agoYep, I explicitly mentioned this bit in the article. Then again, when your thread performs some long blocking call and you want to kill it, you're out of luck anyway. The advice in the post is directly applicable to problems where the blocking calls aren't particularly long.