Deci2: port to std::atomic

This commit is contained in:
Gregory Hainaut 2016-02-22 21:40:45 +01:00
parent 3a9bd90a3b
commit 410922a943
2 changed files with 5 additions and 4 deletions

View File

@ -52,7 +52,6 @@ struct DECI2_DBGP_BRK{
extern DECI2_DBGP_BRK ebrk[32], ibrk[32];
extern s32 ebrk_count, ibrk_count;
extern volatile long runStatus;
extern s32 runCode, runCount;
extern Threading::Semaphore* runEvent;

View File

@ -24,6 +24,8 @@ using namespace Threading;
using namespace R5900;
std::atomic<int> runStatus;
struct DECI2_DBGP_HEADER{
DECI2_HEADER h; //+00
u16 id; //+08
@ -358,7 +360,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char
if (in->h.destination=='I')
;
else{
out->result = ( pcsx2_InterlockedExchange(&runStatus, STOP)==STOP ?
out->result = ( runStatus.exchange(STOP)==STOP ?
0x20 : 0x21 );
out->code=0xFF;
Sleep(50);
@ -371,7 +373,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char
if (in->h.destination=='I')
;
else{
pcsx2_InterlockedExchange(&runStatus, STOP);
runStatus = STOP;
Sleep(100);//first get the run thread to Wait state
runCount=in->count;
runCode=in->code;
@ -390,7 +392,7 @@ void D2_DBGP(const u8 *inbuffer, u8 *outbuffer, char *message, char *eepc, char
for (i=0, s=0; i<(int)run->argc; i++, argv++) s+=argv[i];
memcpy(PSM(0), argv, s);
// threads_array[0].argstring = 0;
pcsx2_InterlockedExchange((volatile long*)&runStatus, (u32)STOP);
runStatus = STOP;
Sleep(1000);//first get the run thread to Wait state
runCount=0;
runCode=0xFF;