return (void*)ALIGN_DOWN(esp, THREADSTACKSIZE);
}
-static int ThreadControl;
+static u8 CanInterrupt, ThreadControl;
// Initialize the support for internal threads.
void
-thread_init(void)
+thread_setup(void)
{
+ CanInterrupt = 1;
if (! CONFIG_THREADS)
return;
ThreadControl = romfile_loadint("etc/threads", 1);
yield(void)
{
if (MODESEGMENT || !CONFIG_THREADS) {
- check_irqs();
+ if (MODESEGMENT || CanInterrupt)
+ check_irqs();
return;
}
struct thread_info *cur = getCurThread();
- if (cur == &MainThread)
+ if (cur == &MainThread && CanInterrupt)
// Permit irqs to fire
check_irqs();
yield();
return;
}
- wait_irq();
+ if (MODESEGMENT || CanInterrupt)
+ wait_irq();
}
// Wait for all threads (other than the main thread) to complete.
struct thread_info *getCurThread(void);
void yield(void);
void yield_toirq(void);
-void thread_init(void);
+void thread_setup(void);
int threads_during_optionroms(void);
void run_thread(void (*func)(void*), void *data);
void wait_threads(void);