Re: [PATCH 2/2] pack-objects: fix threaded load balancing
On Tue, 11 Dec 2007, Johannes Sixt wrote:
Show 22 quoted lines
> 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.
Are you willing to make a patch for it?
Nicolas