Seanforfun / GMAN_Net_Haze_Removal

Single Image Dehazing with a Generic Model-Agnostic Convolutional Neural Network
https://ieeexplore.ieee.org/document/8686264
38 stars 21 forks source link

Cannot exit thread because queue block forever. #3

Closed Seanforfun closed 6 years ago

Seanforfun commented 6 years ago

In dehaze_transmission.py, the task queue will block forever.

Seanforfun commented 6 years ago
  1. The bug is caused by multi-threading. Since producer is continuously producing and the status of the task is modified between reading the status and polling the queue. So the task is blocked due to this reason the thread will not exit.
  2. After producer finishing all its job, it can put a signal into the queue and the consumer will check if producer is end and will pass the signal to next consumer.
    # Producer
    # Put a exit signal into the queue to inform the producer
    self.task_queue.put(None)
    # Consumer
    if task is None:
    self.task_queue.put(None)
    break