Singleton template (三)

2014-11-23 23:40:12 · 作者: · 浏览: 8
}; private: void Guard() { pthread_mutex_lock(&m_cs); m_guardcount++; } void Unguard() { m_guardcount--; pthread_mutex_unlock(&m_cs); } // Guard/Unguard can only be accessed by the nested Guard class. friend class ResGuard::Lock; private: pthread_mutex_t m_cs; long m_guardcount; // # of EnterCriticalSection calls };