mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Check we dont go over control.threads when trying to fill the other stream.
Update comments to reflect when we can go over control.threads.
This commit is contained in:
parent
0b0f6db606
commit
0bded0a7d9
7
stream.c
7
stream.c
|
|
@ -1128,7 +1128,10 @@ retry:
|
||||||
|
|
||||||
static int threads_busy;
|
static int threads_busy;
|
||||||
|
|
||||||
/* fill a buffer from a stream - return -1 on failure */
|
/* Fill a buffer from a stream - return -1 on failure. Note we can end up
|
||||||
|
* running one more thread than control.threads as we always recruit one thread
|
||||||
|
* when fill_buffer is called. This is to ensure that we don't block waiting
|
||||||
|
* for stream 0 to fill. */
|
||||||
static int fill_buffer(struct stream_info *sinfo, int stream)
|
static int fill_buffer(struct stream_info *sinfo, int stream)
|
||||||
{
|
{
|
||||||
i64 header_length, u_len, c_len, last_head;
|
i64 header_length, u_len, c_len, last_head;
|
||||||
|
|
@ -1214,7 +1217,7 @@ fill_another:
|
||||||
s->eos = 1;
|
s->eos = 1;
|
||||||
if (s->eos) {
|
if (s->eos) {
|
||||||
stream ^= 1;
|
stream ^= 1;
|
||||||
if (sinfo->s[stream].eos)
|
if (sinfo->s[stream].eos || threads_busy >= control.threads)
|
||||||
goto out;
|
goto out;
|
||||||
s = &sinfo->s[stream];
|
s = &sinfo->s[stream];
|
||||||
goto fill_different_stream;
|
goto fill_different_stream;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue