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(); } }
RemapLock::RemapLock() { _remapLock.lock(); }
SimpleThreadLock::SimpleThreadLock(SimpleMutex &mutex) : m_mutex(mutex), m_locked(true) { mutex.lock(); }