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:
gbeauche 2005-06-30 10:17:58 +00:00
parent c9b044aeaf
commit 08c5f8b713
5 changed files with 8 additions and 3 deletions

View File

@ -1248,6 +1248,7 @@ status_t SheepShaver::tick_func(void *arg)
void TriggerInterrupt(void)
{
idle_resume();
#if 0
WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1);
#else

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -915,6 +915,7 @@ void emul_ppc(uint32 entry)
void TriggerInterrupt(void)
{
idle_resume();
#if 0
WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1);
#else