Detach threads from the compression side since we don't explicitly join them as they may count towards max thread count otherwise.

This commit is contained in:
Con Kolivas 2011-04-23 08:15:44 +10:00
parent dcc3606507
commit 7ed977b1c1

View file

@ -138,10 +138,16 @@ static void cond_broadcast(pthread_cond_t *cond)
void create_pthread(pthread_t *thread, pthread_attr_t * attr,
void * (*start_routine)(void *), void *arg)
{
if (pthread_create(thread, attr, start_routine, arg))
if (unlikely(pthread_create(thread, attr, start_routine, arg)))
fatal("pthread_create");
}
void detach_pthread(pthread_t *thread)
{
if (unlikely(pthread_detach(*thread)))
fatal("pthread_detach");
}
void join_pthread(pthread_t th, void **thread_return)
{
if (pthread_join(th, thread_return))
@ -1435,6 +1441,7 @@ static void clear_buffer(rzip_control *control, struct stream_info *sinfo, int s
s->i = i;
s->control = control;
create_pthread(&threads[i], NULL, compthread, s);
detach_pthread(&threads[i]);
if (newbuf) {
/* The stream buffer has been given to the thread, allocate a