mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Limit the maximum number of threads on stream 0 to 1 again as stream 1 data always appear after a chunk of stream 0 data.
This commit is contained in:
parent
8ee9ef64f5
commit
0b0f6db606
1
rzip.h
1
rzip.h
|
|
@ -278,6 +278,7 @@ struct stream {
|
|||
long uthread_no;
|
||||
long unext_thread;
|
||||
long base_thread;
|
||||
int total_threads;
|
||||
};
|
||||
|
||||
struct stream_info {
|
||||
|
|
|
|||
13
stream.c
13
stream.c
|
|
@ -843,7 +843,7 @@ void *open_stream_in(int f, int n)
|
|||
if (unlikely(!sinfo))
|
||||
return NULL;
|
||||
|
||||
total_threads = control.threads * 2;
|
||||
total_threads = control.threads + 1;
|
||||
threads = calloc(sizeof(pthread_t), total_threads);
|
||||
if (unlikely(!threads))
|
||||
return NULL;
|
||||
|
|
@ -867,11 +867,14 @@ void *open_stream_in(int f, int n)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sinfo->s[0].total_threads = 1;
|
||||
sinfo->s[1].total_threads = control.threads;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
uchar c;
|
||||
i64 v1, v2;
|
||||
|
||||
sinfo->s[i].base_thread = control.threads * i;
|
||||
sinfo->s[i].base_thread = i;
|
||||
sinfo->s[i].uthread_no = sinfo->s[i].base_thread;
|
||||
sinfo->s[i].unext_thread = sinfo->s[i].base_thread;
|
||||
|
||||
|
|
@ -1202,7 +1205,7 @@ fill_another:
|
|||
s->uthread_no, c_len, stream);
|
||||
create_pthread(&threads[s->uthread_no], NULL, ucompthread, (void *)s->uthread_no);
|
||||
|
||||
if (++s->uthread_no == s->base_thread + control.threads)
|
||||
if (++s->uthread_no == s->base_thread + s->total_threads)
|
||||
s->uthread_no = s->base_thread;
|
||||
|
||||
/* Reached the end of this stream, no more data to read in, otherwise
|
||||
|
|
@ -1217,7 +1220,7 @@ fill_another:
|
|||
goto fill_different_stream;
|
||||
}
|
||||
if (s->uthread_no != s->unext_thread &&
|
||||
!ucthread[s->uthread_no].busy && threads_busy < control.threads)
|
||||
!ucthread[s->uthread_no].busy && threads_busy < s->total_threads)
|
||||
goto fill_another;
|
||||
out:
|
||||
s = ret_s;
|
||||
|
|
@ -1240,7 +1243,7 @@ out:
|
|||
* ucompthread, we reset it regardless. */
|
||||
init_sem(&ucthread[s->unext_thread].ready);
|
||||
|
||||
if (++s->unext_thread == s->base_thread + control.threads)
|
||||
if (++s->unext_thread == s->base_thread + s->total_threads)
|
||||
s->unext_thread = s->base_thread;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue