Subject: Re: [boost] [thread/interprocess] [repost] could we improve recursive_mutex constructor
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-01-24 17:46:22


vicente.botet wrote:
> Hello, I first posted this six months ago, allow me to repost just in
> case it went unnoticed:

Yes, it went unnoticed ;-)

>> the recursive_mutex constructor initialize/set/destroy the
>> pthread_mutexattr_t every time.
>> I'm wondering if we can improve the efficiency storing this on a static
>> variable which will be initialized once.
>> What could be the better way to initialize this static variable?
>>
>> Note: the same applies to interprocess mutexes.

Storing static variables is tricky because of thread-race issues and
mutex attributes usually are very lightweight (usually just setting some
flags) so there is no much overhead with this.

Regards,

Ion