Subj : How to return a value before leaving critical section? To : comp.programming.threads From : MC Date : Tue Jul 19 2005 07:49 pm Threading newbie here. This question has surely been answered 1000 times. I have a member variable that I want to share between two threads. I make it private and I write a public accessor function, inside which, I use a mutex--actually, I use a Windows CRITICAL_SECTION variable and then call Enter/LeaveCriticalSection() but I'm hoping that's beside the point. The dilemna, of course, is that both statements need to be the last statement of the function: return m_MyMember; *and* LeaveCriticalSection(m_pMyCrSection); I could use an output parameter instead of a return value but then the calling code gets uggggglyyy! Is this the only solution? TIA Craig .