From: Johannes Sixt Date: Tue, 11 Dec 2007 17:02:35 GMT Subject: Re: [PATCH 2/2] pack-objects: fix threaded load balancing Message-ID: <475EC2AB.60702@viscovery.net> In-Reply-To: Nicolas Pitre schrieb: > @@ -1612,10 +1620,10 @@ static void *threaded_find_deltas(void *arg) > pthread_mutex_lock(&data_ready); > pthread_mutex_unlock(&data_request); > > - if (!me->list_size) > + if (!me->remaining) > return NULL; > > - find_deltas(me->list, me->list_size, > + find_deltas(me->list, &me->remaining, > me->window, me->depth, me->processed); > } > } This hunk caught my attention. &data_ready is locked, but not released in this function. Looking more closely at the code surrounding this hunk, it seems that the lock is released in a *different* thread than the one that locked it. This works on Linux, but is not portable. We will have to use condition variables like every one else does in a producer-consumer-like scenario. -- Hannes