osCreateScheduler osCreateScheduler (function)

Creates an RCP task scheduler

Syntax

#include <ultra64.h>     /* ultra64.h */
void osCreateScheduler(OSSched *s, void *stack, OSPri priority, 
                u8 mode, u8 retreceCount);

Arguments

s
the pointer to the scheduler structure to initialize
stack
the pointer to the stack for the scheduler thread
priority
the priority for the scheduler thread
mode
the video mode with which to initialize the VI Manager
retraceCount
the number of retraces per retrace message sent

Description

The Scheduler is a host CPU thread that is responsible for executing audio and graphics tasks on the RCP so that host and RCP overrun is minimized or eliminated.

Each video retrace, the Scheduler reads the new tasks generated by the scheduler client threads from the task queue and adds them to the end of a real-time (audio) or non-real-time (graphics) task schedule list.

If the previous frame's graphics task has overrun, the Scheduler causes the task to yield. It then runs the next audio task, resuming the yielded task when the audio task has completely processed. Then it runs any additional graphics tasks that are to be run in the current frame.

When a task completes, the Scheduler sends a message to the client indicating that the work it requested is complete.

Before using the Scheduler, you must first call osCreateScheduler to initialize the OSSched data structure along with its message queues and the VI Manager. The osCreateScheduler function spawns a thread to schedule and manage task execution. One of its arguments is the thread priority, which should be higher than that of the threads that generate the command lists.

See Also

osScAddClient, osScGetTaskQ

Revision History

1999/04/30 Changed format