示例#1
0
void LintelLog::maybeInitInstance() {
    static SimpleMutex init_mutex;

    // is this actually safe?  Really don't want to have to take the
    // lock when we almost never need to.
    if (instance == NULL) {
	init_mutex.lock();
	if (instance == NULL) {
	    instance_data *tmp = new instance_data();
	    tmp->mutex.lock(); // try to force the above to be 
	    tmp->mutex.unlock();
	    instance = tmp;
	}
	init_mutex.unlock();
    }
}
示例#2
0
 RemapLock::RemapLock() {
     _remapLock.lock();
 }
示例#3
0
文件: mutex.cpp 项目: nefthon/Source
SimpleThreadLock::SimpleThreadLock(SimpleMutex &mutex) : m_mutex(mutex), m_locked(true)
{
	mutex.lock();
}