mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-14 20:05:02 +00:00
More documentation for sched.c (#1219)
* More documentation for sched.c * VI retrace -> vertical retrace, attempt to clarify comment in viconfig * Further review changes, fix inconsistent capitalization of PreNMI (PRENMI -> PreNMI) * Fix typo Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Change TaskSwapBuffer, change comment on OS_SC_DRAM_DLIST to unimplemented * Rename SchedContext/gSchedContext to Scheduler/gScheduler * Comments fixes Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Format Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
ee5ac838b6
commit
1738b19d63
20 changed files with 449 additions and 268 deletions
27
src/code/z_nulltask.c
Normal file
27
src/code/z_nulltask.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "global.h"
|
||||
|
||||
/**
|
||||
* Blocks the current thread until all queued scheduler tasks have completed.
|
||||
*/
|
||||
void Sched_FlushTaskQueue(void) {
|
||||
OSScTask task;
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg;
|
||||
|
||||
// Prepare a "NULL" task
|
||||
task.next = NULL;
|
||||
task.flags = OS_SC_NEEDS_RDP | OS_SC_NEEDS_RSP;
|
||||
task.msgQueue = &queue;
|
||||
task.msg = NULL;
|
||||
task.framebuffer = NULL;
|
||||
task.list.t.type = M_NULTASK;
|
||||
osCreateMesgQueue(task.msgQueue, &msg, 1);
|
||||
|
||||
// Send it to and wake up the scheduler
|
||||
osSendMesg(&gScheduler.cmdQueue, (OSMesg)&task, OS_MESG_BLOCK);
|
||||
Sched_Notify(&gScheduler);
|
||||
|
||||
// Wait until the task has been processed, indicating that no task is
|
||||
// running and the task queue is now empty.
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue