merged windows/linux atomic operations,

please test on windows


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1391 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2008-12-04 10:58:45 +00:00
parent 9692fca60e
commit b64877d464
5 changed files with 36 additions and 63 deletions

View File

@ -104,11 +104,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
// check if we are able to run this buffer
if ((_fifo.bFF_GPReadEnable) && _fifo.CPReadWriteDistance && !(_fifo.bFF_BPEnable && _fifo.bFF_Breakpoint))
{
#ifdef _WIN32
InterlockedExchange((LONG*)&_fifo.CPReadIdle, 0);
#else
Common::InterlockedExchange((int*)&_fifo.CPReadIdle, 0);
#endif
Common::InterlockedExchange((LONG*)&_fifo.CPReadIdle, 0);
//video_initialize.pLog("RUN...........................",FALSE);
int peek_counter = 0;
while (_fifo.bFF_GPReadEnable && (_fifo.CPReadWriteDistance > 0))
@ -129,11 +125,8 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
if (readPtr == _fifo.CPBreakpoint)
{
video_initialize.pLog("!!! BP irq raised",FALSE);
#ifdef _WIN32
InterlockedExchange((LONG*)&_fifo.bFF_Breakpoint, 1);
#else
Common::InterlockedExchange((int*)&_fifo.bFF_Breakpoint, 1);
#endif
Common::InterlockedExchange((LONG*)&_fifo.bFF_Breakpoint, 1);
video_initialize.pUpdateInterrupts();
break;
}
@ -163,20 +156,11 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
#endif
}
Video_SendFifoData(uData, distToSend);
#ifdef _WIN32
InterlockedExchange((LONG*)&_fifo.CPReadPointer, readPtr);
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -distToSend);
#else
Common::InterlockedExchange((int*)&_fifo.CPReadPointer, readPtr);
Common::InterlockedExchangeAdd((int*)&_fifo.CPReadWriteDistance, -distToSend);
#endif
Common::InterlockedExchange((LONG*)&_fifo.CPReadPointer, readPtr);
Common::InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -distToSend);
}
//video_initialize.pLog("..........................IDLE",FALSE);
#ifdef _WIN32
InterlockedExchange((LONG*)&_fifo.CPReadIdle, 1);
#else
Common::InterlockedExchange((int*)&_fifo.CPReadIdle, 1);
#endif
Common::InterlockedExchange((LONG*)&_fifo.CPReadIdle, 1);
}
}
}