static CSingleton* GetInstance() { if( m_pInstance == NULL ) //优化性能,总比锁快 { CAutoLock lock( &cs ); //防止多线程引起的同步问题 if( m_pInstance == NULL ) //确保该段代码进入单线程模式,開始可靠性推断 { m_pInstance = new CSingleton; } } return m_pInstance; }
2014年11月19日15:54:52
转载于:https://www.cnblogs.com/bhlsheji/p/5148705.html