Code: Select all
while(!((*CSR) & GS_VSINT))
/* do nothing */ ;
Is there a more elegant way of doing this? Most of the "delay" routines I've seen have been NOP loops as well.
Here's what I'm thinking: I suppose there's a way to hook an interrupt handler on the VSync signal from the GS; the render thread could call SleepThread() when it's done working. The interrupt handler would then call iWakeupThread() on the render thread when it gets its interrupt, and the render thread would pick up where it left off. Meanwhile, the worker threads could be chugging along, doing their own things.
Is this the correct way of doing it? How hard is it to add an interrupt handler?
A somewhat-related question regarding threads on the PS2 -- does the kernel automatically handle the context switches? Or does each thread need to call a suspend() routine (i.e., non-preemptive multitasking).
thx