template <class T> void singleton<T>::Release() {
if (m_lpObj!=NULL) {
if (CAppInitializer::IsMultiThread()){
// マルチスレッド時は、double-checked locking
CCriticalLock guard(&m_cs);
if (m_lpObj!=NULL){
delete m_lpObj;
m_lpObj = NULL;
}
} else {
delete m_lpObj;
m_lpObj = NULL;
}
}
}
|