
24 Jan
2009
24 Jan
'09
10:46 p.m.
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