Send one-way message to all threads in Python

后端 未结 1 959
挽巷
挽巷 2020-12-19 17:11

I need to send information to every thread that\'s running in my program, and every thread has to process that information.

I can\'t do it using a regular queue, bec

相关标签:
1条回答
  • 2020-12-19 17:43

    One way is to have a queue for each thread, and the function that broadcasts the information is responsible for inserting the message into the queue of every thread.

    This is similar to the way message queues work in Windows, for example. Each thread that does GUI operations has an associated message queue, independent from that of any other thread.

    0 讨论(0)
提交回复
热议问题