Subj : Re: Can C++ local static objects be made thread safe? To : comp.programming.threads From : David Schwartz Date : Sat Feb 12 2005 03:10 pm "Gianni Mariani" wrote in message news:kNCdnWBwbqDJ7pPfRVn-pA@speakeasy.net... >> The COFU must already have been called BEFORE any thread is started. >> I've dissucessed it MUCH before; I was giving it for granted that >> *the_item has been created safely before those two threads are >> started... > If it's a recursive mutex, no deadlock happens. It doesn't even have to be recursive if the COFU has been called before any thread is started. I can't follow Gianni Mariana's points at all. If the COFU has already been initialized, the COFU code reduces to: acquire_mutex(); if(false) initialize_object(); release_mutex(); That can't possibly deadlock with anything. DS .