@@ -362,11 +362,11 @@ def _compress(self, index: int):
362
362
in_queue = self .input_queues [index ]
363
363
out_queue = self .output_queues [index ]
364
364
compressor : zlib_ng ._ParallelCompress = self .compressors [index ]
365
- while self . _calling_thread . is_alive () :
365
+ while True :
366
366
try :
367
367
data , zdict = in_queue .get (timeout = 0.05 )
368
368
except queue .Empty :
369
- if not self .running :
369
+ if not ( self .running and self . _calling_thread . is_alive ()) :
370
370
return
371
371
continue
372
372
try :
@@ -382,13 +382,13 @@ def _compress(self, index: int):
382
382
def _write (self ):
383
383
index = 0
384
384
output_queues = self .output_queues
385
- while self . _calling_thread . is_alive () :
385
+ while True :
386
386
out_index = index % self .threads
387
387
output_queue = output_queues [out_index ]
388
388
try :
389
389
compressed , crc , data_length = output_queue .get (timeout = 0.05 )
390
390
except queue .Empty :
391
- if not self .running :
391
+ if not ( self .running and self . _calling_thread . is_alive ()) :
392
392
return
393
393
continue
394
394
self ._crc = zlib_ng .crc32_combine (self ._crc , crc , data_length )
@@ -402,11 +402,11 @@ def _compress_and_write(self):
402
402
raise SystemError ("Compress_and_write is for one thread only" )
403
403
in_queue = self .input_queues [0 ]
404
404
compressor = self .compressors [0 ]
405
- while self . _calling_thread . is_alive () :
405
+ while True :
406
406
try :
407
407
data , zdict = in_queue .get (timeout = 0.05 )
408
408
except queue .Empty :
409
- if not self .running :
409
+ if not ( self .running and self . _calling_thread . is_alive ()) :
410
410
return
411
411
continue
412
412
try :
0 commit comments