Revert "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 reverts commit 0b0f6db606.
This commit is contained in:
Con Kolivas 2011-02-09 12:39:02 +11:00
parent 44399d88ac
commit 8239635038
2 changed files with 5 additions and 9 deletions

1
rzip.h
View file

@ -278,7 +278,6 @@ struct stream {
long uthread_no;
long unext_thread;
long base_thread;
int total_threads;
};
struct stream_info {

View file

@ -843,7 +843,7 @@ void *open_stream_in(int f, int n)
if (unlikely(!sinfo))
return NULL;
total_threads = control.threads + 1;
total_threads = control.threads * 2;
threads = calloc(sizeof(pthread_t), total_threads);
if (unlikely(!threads))
return NULL;
@ -867,14 +867,11 @@ 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 = i;
sinfo->s[i].base_thread = control.threads * i;
sinfo->s[i].uthread_no = sinfo->s[i].base_thread;
sinfo->s[i].unext_thread = sinfo->s[i].base_thread;
@ -1205,7 +1202,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 + s->total_threads)
if (++s->uthread_no == s->base_thread + control.threads)
s->uthread_no = s->base_thread;
/* Reached the end of this stream, no more data to read in, otherwise
@ -1220,7 +1217,7 @@ fill_another:
goto fill_different_stream;
}
if (s->uthread_no != s->unext_thread &&
!ucthread[s->uthread_no].busy && threads_busy < s->total_threads)
!ucthread[s->uthread_no].busy && threads_busy < control.threads)
goto fill_another;
out:
s = ret_s;
@ -1243,7 +1240,7 @@ out:
* ucompthread, we reset it regardless. */
init_sem(&ucthread[s->unext_thread].ready);
if (++s->unext_thread == s->base_thread + s->total_threads)
if (++s->unext_thread == s->base_thread + control.threads)
s->unext_thread = s->base_thread;
return 0;