summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-10-23 17:05:55 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-10-23 17:05:55 +0300
commit6b620a0f0813d28c3c544b4ff8cb595b38a6e908 (patch)
tree07879b2693eb528438d31855e30401c24b6f756b
parentbd52cf150ecd51e3ab63a9cc1a3cff6a77500178 (diff)
downloadxz-6b620a0f0813d28c3c544b4ff8cb595b38a6e908.tar.gz
liblzma: Fix a deadlock in the threaded encoder.
It was triggered when reinitializing the encoder, e.g. when encoding two files.
-rw-r--r--src/liblzma/common/stream_encoder_mt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liblzma/common/stream_encoder_mt.c b/src/liblzma/common/stream_encoder_mt.c
index 323f04a..a4b2800 100644
--- a/src/liblzma/common/stream_encoder_mt.c
+++ b/src/liblzma/common/stream_encoder_mt.c
@@ -295,8 +295,10 @@ worker_start(void *thr_ptr)
while (true) {
// The thread is already idle so if we are
// requested to stop, just set the state.
- if (thr->state == THR_STOP)
+ if (thr->state == THR_STOP) {
thr->state = THR_IDLE;
+ pthread_cond_signal(&thr->cond);
+ }
state = thr->state;
if (state != THR_IDLE)