Subj : Recursive mutexes To : comp.programming.threads From : notme Date : Thu Mar 24 2005 12:07 am I'm trying to implement in C++ a recursive mutex class, because the operating system doesn't provide one (it only provides ordinary mutexes and critical sections) So far, I have done this: void my_mutex::acquire() { EnterCriticalSection(); if (m_owner == thread_id) { ++m_count; } else { m_mutex->wait(); m_count = 1; m_owner = thread_id; } ExitCriticalSection(); } void my_mutex::release() { EnterCriticalSection(); --m_count; if (m_count == 0) m_mutex->signal(); ExitCriticalSection(); } I guess the variable's names are self-explanatory. Is this implementation ok? I'd like to hear from the experts here any comment or advice about corrections, performance changes, etc. Remember that I can only use these primitives. Thanks! .