=== modified file 'storage/archive/azio.c' --- storage/archive/azio.c 2009-03-17 20:07:27 +0000 +++ storage/archive/azio.c 2009-07-29 18:16:52 +0000 @@ -72,6 +72,7 @@ static pthread_handler_t run_task(void * pthread_mutex_lock(&s->container.thresh_mutex); s->container.ready= AZ_THREAD_FINISHED; + pthread_cond_broadcast(&s->container.threshhold); pthread_mutex_unlock(&s->container.thresh_mutex); } @@ -100,21 +101,20 @@ static size_t azio_return(azio_stream *s Don't be. In tests it never has spun more then 1 times. */ -static az_thread_type azio_ready(azio_stream *s) +static void azio_ready(azio_stream *s) { - az_thread_type temp; + pthread_mutex_lock(&s->container.thresh_mutex); while (1) { - pthread_mutex_lock(&s->container.thresh_mutex); - temp= s->container.ready; - pthread_mutex_unlock(&s->container.thresh_mutex); - - if (temp == AZ_THREAD_FINISHED || temp == AZ_THREAD_DEAD) + if (s->container.ready == AZ_THREAD_FINISHED || + s->container.ready == AZ_THREAD_DEAD) break; + + pthread_cond_wait(&s->container.threshhold, &s->container.thresh_mutex); } - return temp; + pthread_mutex_unlock(&s->container.thresh_mutex); } static int azio_start(azio_stream *s)