3f0 Subj : Re: mutex problem To : comp.programming.threads From : David Schwartz Date : Fri Jun 17 2005 12:50 pm "LinuxGuy" wrote in message news:1118993531.608953.234730@o13g2000cwo.googlegroups.com... > here I want to update "sampleString" and this function will be > called from any other cpp file but at that time "threadFunction may > have locked the resources. and using "sampleString" can you please > tell me how to protect data or to execute functions without affecting > each others data You just simply cannot do this. You cannot create a sensible function that manipulates a particular structure without knowing whether or not that structure is already locked. You should create two versions of this function, one that can only be called with the lock held and one that can only be called without the lock held. The version called without the lock held can simply acquire the lock and then call the other version. DS . 0