[Sheepdog] [PATCH] sheep: remove the unnecessary mutex operations

Liu Yuan namei.unix at gmail.com
Tue Jan 10 09:01:17 CET 2012


On 01/10/2012 03:52 PM, MORITA Kazutaka wrote:

> At Sat,  7 Jan 2012 14:29:02 +0800,
> Liu Yuan wrote:
>>
>> From: Liu Yuan <tailai.ly at taobao.com>
>>
>> We do nothing while we hold the mutex, then we don't need it.
>>
>> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
>> ---
>>  sheep/work.c |    4 ----
>>  1 files changed, 0 insertions(+), 4 deletions(-)
>>
>> diff --git a/sheep/work.c b/sheep/work.c
>> index 789272e..de3f500 100644
>> --- a/sheep/work.c
>> +++ b/sheep/work.c
>> @@ -194,10 +194,6 @@ static void *worker_routine(void *arg)
>>  	struct work *work;
>>  	eventfd_t value = 1;
>>  
>> -	pthread_mutex_lock(&wi->startup_lock);
>> -	/* started this thread */
>> -	pthread_mutex_unlock(&wi->startup_lock);
>> -
> 
> This lock is used to ensure that all worker threads are correctly
> started up.
> 


Why we need mutex here to ensure correct start-up? We get the lock, do
nothing and then unlock, looks a null operation to me.

Thanks,
Yuan



More information about the sheepdog mailing list