[sheepdog] [PATCH UPDATE] work: make short thread DETACHED

Liu Yuan namei.unix at gmail.com
Tue Jul 3 12:41:59 CEST 2012


On 07/03/2012 06:33 PM, MORITA Kazutaka wrote:
> At Tue, 03 Jul 2012 18:25:23 +0800,
> Liu Yuan wrote:
>>
>> On 07/03/2012 06:22 PM, MORITA Kazutaka wrote:
>>> If we detach the thread just after it starts, isn't it better to
>>> create it in a detached state using pthread_attr_setdetachstate?
>>
>> why better? It cost several more lines to init attr and destroy it. what
>> is benefit using attr over pathread_detach()?
> 
> I thought that it makes clear that the thread is never in a joinable
> state, but looks like it's a matter of taste...
> 
> Reviewed-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
>

Actually I firstly tried to use attr, but besides more lines to
init/destroy attr, I had to add more lines to check retval of those
functions, it made the code a bit ugly and then I switched to single
pthread_detach() call.

Thanks,
Yuan






More information about the sheepdog mailing list