Ejemplo 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 );
}
Ejemplo 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;
}
Ejemplo 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();
    }
}
Ejemplo 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;
	}
}
Ejemplo n.º 5
0
 RemapLock::~RemapLock() {
     _remapLock.unlock();
 }
Ejemplo n.º 6
0
 RemapLock::RemapLock() {
     _remapLock.lock();
 }
Ejemplo n.º 7
0
SimpleThreadLock::SimpleThreadLock(SimpleMutex &mutex) : m_mutex(mutex), m_locked(true)
{
	mutex.lock();
}
Ejemplo n.º 8
0
void RakString::UnlockMutex(void)
{
	poolMutex.Unlock();
}
Ejemplo n.º 9
0
void RakString::LockMutex(void)
{
	poolMutex.Lock();
}