mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-18 18:05:21 +00:00
Improve idle wait mechanism. Now, the emulator thread can be suspended
(idle_wait) until events arrived and notified through TriggerInterrupt(). i.e. we no longer sleep a fixed amount of time on platforms that support a thread wait/signal mechanism.
This commit is contained in:
parent
c9b044aeaf
commit
08c5f8b713
@ -1248,6 +1248,7 @@ status_t SheepShaver::tick_func(void *arg)
|
||||
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
idle_resume();
|
||||
#if 0
|
||||
WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1);
|
||||
#else
|
||||
|
@ -192,6 +192,7 @@ no:linux*|no:netbsd*)
|
||||
])
|
||||
])
|
||||
AC_CHECK_FUNCS(pthread_cancel)
|
||||
AC_CHECK_FUNCS(pthread_cond_init)
|
||||
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
|
||||
AC_CHECK_FUNCS(pthread_mutexattr_settype)
|
||||
AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
|
||||
|
@ -1513,8 +1513,10 @@ void B2_delete_mutex(B2_mutex *mutex)
|
||||
#if !EMULATED_PPC
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
if (ready_for_signals)
|
||||
if (ready_for_signals) {
|
||||
idle_resume();
|
||||
pthread_kill(emul_thread, SIGUSR2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -463,14 +463,14 @@ void EmulOp(M68kRegisters *r, uint32 pc, int selector)
|
||||
case OP_IDLE_TIME:
|
||||
// Sleep if no events pending
|
||||
if (ReadMacInt32(0x14c) == 0)
|
||||
Delay_usec(16667);
|
||||
idle_wait();
|
||||
r->a[0] = ReadMacInt32(0x2b6);
|
||||
break;
|
||||
|
||||
case OP_IDLE_TIME_2:
|
||||
// Sleep if no events pending
|
||||
if (ReadMacInt32(0x14c) == 0)
|
||||
Delay_usec(16667);
|
||||
idle_wait();
|
||||
r->d[0] = (uint32)-2;
|
||||
break;
|
||||
|
||||
|
@ -915,6 +915,7 @@ void emul_ppc(uint32 entry)
|
||||
|
||||
void TriggerInterrupt(void)
|
||||
{
|
||||
idle_resume();
|
||||
#if 0
|
||||
WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user