Re: [PATCH 2/2] pack-objects: fix threaded load balancing
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Dec 11, 2007, 17:02 UTC
- Message-ID
- <475EC2AB.60702@viscovery.net>
- In-Reply-To
- <alpine.LFD.0.99999.0712080000120.555@xanadu.home>
Nicolas Pitre schrieb:
Show 13 quoted lines
> @@ -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