Roland Schwarz wrote:
Michael Garriss wrote:
err. those exmaples got mixed up (thx Bklyn). global mutex breaks it and member var mutex works.
Using a global mutex causes the pthread_mutex_init to be called before main. A quick poll on the comp.programmin.threads showed the answer that this should be allowed. However I am still suspicious.
Beeing back from comp.alt.programming.threads I have to say that the current boost usage of the pthreads lib seems to be the culprit. Altough there seems to exist a recommendation to use mutexes in a global manner, the way boost is using this at the moment seems to prevent exactly this case. For the time being I recommend to avoid this usage. It has to be discussed if the situation can be improved. However in any case I suspect boost.thread will need to add the prerequisite of not allowing any use of the mutex before main has started up. I.e. specifically no threads may be started from global ctors. But please don't take this for granted now. More research will need to take place. regards, Roland