mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-02-20 06:14:17 +01:00
Make threaded decompression more robust on failure.
This changes the decompression worker thread to signal the main thread in case of failure, allowing the main thread to handle this appropriately instead of just assuming the resulting data is always good.
This commit is contained in:
parent
1a1723834b
commit
8eba9a202e
6
stream.c
6
stream.c
|
|
@ -1543,7 +1543,7 @@ retry:
|
|||
* parallel */
|
||||
if (unlikely(ret)) {
|
||||
if (unlikely(waited))
|
||||
failure_return(("Failed to decompress in ucompthread\n"), NULL);
|
||||
failure_return(("Failed to decompress in ucompthread\n"), (void*)1);
|
||||
print_maxverbose("Unable to decompress in parallel, waiting for previous thread to complete before trying again\n");
|
||||
/* We do not strictly need to wait for this, so it's used when
|
||||
* decompression fails due to inadequate memory to try again
|
||||
|
|
@ -1568,6 +1568,7 @@ static int fill_buffer(rzip_control *control, struct stream_info *sinfo, struct
|
|||
uchar enc_head[25 + SALT_LEN], blocksalt[SALT_LEN];
|
||||
stream_thread_struct *st;
|
||||
uchar c_type, *s_buf;
|
||||
void *thr_return;
|
||||
|
||||
dealloc(s->buf);
|
||||
if (s->eos)
|
||||
|
|
@ -1702,7 +1703,8 @@ out:
|
|||
unlock_mutex(control, &output_lock);
|
||||
|
||||
/* join_pthread here will make it wait till the data is ready */
|
||||
if (unlikely(!join_pthread(control, threads[s->unext_thread], NULL)))
|
||||
thr_return = NULL;
|
||||
if (unlikely(!join_pthread(control, threads[s->unext_thread], &thr_return) || !!thr_return))
|
||||
return -1;
|
||||
ucthread[s->unext_thread].busy = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue