Singleton template (三)
};
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
};