1. Requirements
The General Service provides an agent or listener process, receives network data, and distributes it to the business processing process based on the data type.
The business processing process then processes or creates a new process thread based on the actual situation.
I have a listen_task listening process, defining the queue_from_net queue
__listen_control is responsible for putting the network data cache into queue_from_net
__listen_handle is responsible for obtaining processing data from queue_from_net, and according to the actual situation,
Create a new two __query_schedule process into a query_queue or select_queue queue handled by __query_schedule
Or close the __query_schedule process
2. Realize
__listen_control putting network data into the queue_from_net queue
__listen_handle Create or terminate the __query_schedule process according to start or stop
__query_schedule get processing from the queue
3. Questions
__query_schedule Print out Queue length before Queue_from_listen_task queue get come in
After starting the successful __query_schedule once, stop, then restart queue come in size 1, normal expected get out after Queue_from_listen_task length becomes 0
After shutting down, start again, __query_schedule print queue come in size is 2, last get did not get success queue.
The guess is that the queue lock is not released when the process terminate, resulting in a subsequent queue get not
4. Resolve
Before the terminate process, the displayed queue is released, Task_done ()
Try again, solve the problem
"Multithreaded" Python process, queue and lock-related issues