2021年4月24日星期六

How do I send a variable/flag to another thread in a non-blocking thread safe way in Python?

I've been looking around and see some answers saying to use globals, but doesn't seem thread safe. I have also tried using queues but that is apparently blocking, at least in how I did it. Can someone help/show an example on how to launch a thread from the main thread and communicate between one thread to another in a non-blocking thread safe way? Basically, the use case is that the threads will be looping and checking fairly constantly if there's something that needs to be done/changed and act accordingly. Thanks for the help

https://stackoverflow.com/questions/67249116/how-do-i-send-a-variable-flag-to-another-thread-in-a-non-blocking-thread-safe-wa April 25, 2021 at 10:07AM

没有评论:

发表评论