Get rid of locks added InterlockedExchangeAdd function in thread.cpp
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@748 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
65f8c4bca1
commit
3d6d64c632
|
@ -344,6 +344,17 @@ void Event::Wait()
|
||||||
is_set_ = false;
|
is_set_ = false;
|
||||||
pthread_mutex_unlock(&mutex_);
|
pthread_mutex_unlock(&mutex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InterlockedExchangeAdd( int* Addend, int Increment )
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1 <= __GNUC_MINOR__))
|
||||||
|
return __sync_add_and_fetch(Addend, Increment);
|
||||||
|
#else
|
||||||
|
// TODO support old gcc
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,9 @@ class Event
|
||||||
void SleepCurrentThread(int ms);
|
void SleepCurrentThread(int ms);
|
||||||
|
|
||||||
void SetCurrentThreadName(const char* name);
|
void SetCurrentThreadName(const char* name);
|
||||||
|
|
||||||
|
int InterlockedExchangeAdd( int* Addend, int Increment );
|
||||||
} // end of namespace Common
|
} // end of namespace Common
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -378,10 +378,8 @@ void GatherPipeBursted()
|
||||||
Common::SleepCurrentThread(1);
|
Common::SleepCurrentThread(1);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
|
InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
|
||||||
#else
|
#else
|
||||||
fifo.sync->Enter();
|
Common::InterlockedExchangeAdd((int*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
|
||||||
fifo.CPReadWriteDistance += GPFifo::GATHER_PIPE_SIZE;
|
|
||||||
fifo.sync->Leave();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check if we are in sync
|
// check if we are in sync
|
||||||
|
|
|
@ -217,12 +217,13 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
|
||||||
#endif
|
#endif
|
||||||
_fifo.CPReadPointer += 32;
|
_fifo.CPReadPointer += 32;
|
||||||
Video_SendFifoData(uData);
|
Video_SendFifoData(uData);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32);
|
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32);
|
||||||
LeaveCriticalSection(&_fifo.sync);
|
LeaveCriticalSection(&_fifo.sync);
|
||||||
#else
|
#else
|
||||||
_fifo.CPReadWriteDistance -= 32;
|
Common::InterlockedExchangeAdd((int*)&_fifo.CPReadWriteDistance, -32);
|
||||||
_fifo.sync->Leave();
|
_fifo.sync->Leave();
|
||||||
#endif
|
#endif
|
||||||
// increase the ReadPtr
|
// increase the ReadPtr
|
||||||
if (_fifo.CPReadPointer >= _fifo.CPEnd)
|
if (_fifo.CPReadPointer >= _fifo.CPEnd)
|
||||||
|
|
Loading…
Reference in New Issue