Subj : Re: reliability of setting thread priority To : comp.programming.threads From : David Schwartz Date : Fri Feb 25 2005 11:47 am wrote in message news:1109335689.042110.211170@f14g2000cwb.googlegroups.com... >> Your global static mutex doesn't need to be created. > Sorry, I'm obviously missing something in your meaning - if the mutex > doesn't "exist" what good is it to me? What do you mean 'created'? > initted? something else? In Win32 I'm talking about calling > CreateMutex(). Consider: int i=0; There is no time when this integer doesn't exist, so long as code that can access it is running. > I could wait and call CreateMutex() during the first usage, but then > I'm back to needing a flag/exchange to protect that, and it starts to > seem no better than what I already have. What you need is a mutex or critical section that is initialized by copying static data onto it. Essentially, you need pthread_once. DS .