Add a wait for threads when we hand away control. Probably not needed due to all the extra processing during end-of-frame.

This commit is contained in:
Brandon Wright 2018-04-12 16:51:00 -05:00
parent 045f68bb26
commit e1a4ef93b6
3 changed files with 14 additions and 0 deletions

View File

@ -758,6 +758,16 @@ static inline void S9xAPUUpdateClock (void)
S9xAPUSetReferenceTime(CPU.Cycles); S9xAPUSetReferenceTime(CPU.Cycles);
} }
void S9xAPUWait (void)
{
#ifdef USE_THREADS
if (spc::using_threads)
{
S9xAPUThreadWait();
}
#endif
}
uint8 S9xAPUReadPort (int port) uint8 S9xAPUReadPort (int port)
{ {
#ifdef USE_THREADS #ifdef USE_THREADS

View File

@ -230,5 +230,6 @@ void S9xClearSamples (void);
bool8 S9xMixSamples (uint8 *, int); bool8 S9xMixSamples (uint8 *, int);
void S9xSetSamplesAvailableCallback (apu_callback, void *); void S9xSetSamplesAvailableCallback (apu_callback, void *);
void S9xUpdateDynamicRate (int, int); void S9xUpdateDynamicRate (int, int);
void S9xAPUWait (void);
#endif #endif

View File

@ -319,9 +319,12 @@ void S9xMainLoop (void)
#ifdef DEBUGGER #ifdef DEBUGGER
if (!(CPU.Flags & FRAME_ADVANCE_FLAG)) if (!(CPU.Flags & FRAME_ADVANCE_FLAG))
#endif #endif
S9xAPUWait();
S9xSyncSpeed(); S9xSyncSpeed();
CPU.Flags &= ~SCAN_KEYS_FLAG; CPU.Flags &= ~SCAN_KEYS_FLAG;
} }
} }
static inline void S9xReschedule (void) static inline void S9xReschedule (void)