Exemplo n.º 1
0
/**
 *	Leave a level of model loads in the current thread.
 *	If it was the last level, call the global callbacks.
 */
void PostLoadCallBack::leave()
{
	threadsLock_.grab();
	bool wasLastLevel = (--threads_[OurThreadID()].enterCount == 0);
	threadsLock_.give();

	if (wasLastLevel) run( true );
}
Exemplo n.º 2
0
LONG WINAPI CrashExceptionFilter( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
	// Mutex here due to http://www.jenkinssoftware.com/raknet/forum/index.php?topic=2305.0;topicseen
	static SimpleMutex crashExceptionFilterMutex;
	crashExceptionFilterMutex.Lock();
	LONG retVal = ProcessException(ExceptionInfo); 
	crashExceptionFilterMutex.Unlock();
	return retVal;
}
Exemplo n.º 3
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();
    }
}
Exemplo n.º 4
0
/**
 *	This method runs all callbacks from one of the lists
 */
void PostLoadCallBack::run( bool global )
{
	SimpleMutexHolder smh( threadsLock_ );
	std::vector< PostLoadCallBack * > * cbs;

	PLCBs & plcbs = threads_[OurThreadID()];
	cbs = global ? &plcbs.globals : &plcbs.locals;

	while (!cbs->empty())
	{
		PostLoadCallBack * lf = cbs->front();
		cbs->erase( cbs->begin() );

		threadsLock_.give();
		(*lf)();
		delete lf;
		threadsLock_.grab();

		PLCBs & plcbs = threads_[OurThreadID()];
		cbs = global ? &plcbs.globals : &plcbs.locals;
	}
}
Exemplo n.º 5
0
 RemapLock::~RemapLock() {
     _remapLock.unlock();
 }
Exemplo n.º 6
0
 RemapLock::RemapLock() {
     _remapLock.lock();
 }
Exemplo n.º 7
0
SimpleThreadLock::SimpleThreadLock(SimpleMutex &mutex) : m_mutex(mutex), m_locked(true)
{
	mutex.lock();
}
Exemplo n.º 8
0
void RakString::UnlockMutex(void)
{
	poolMutex.Unlock();
}
Exemplo n.º 9
0
void RakString::LockMutex(void)
{
	poolMutex.Lock();
}