#include <cafe/os.h> typedef int (*OSThread_Proc)(int intArg, void *ptrArg); BOOL OSCreateThread(OSThread* thread , OSThread_Proc entryPoint, int intArg, void* ptrArg, void* stack, u32 stackSize, OSPriority priority, u16 attr);
|thread||Pointer to thread control block to initialize. The alignment of the thread control block is a minimum of 8 bytes.|
|entryPoint||Pointer to function from which to start execution.|
|intArg||Number of arguments to pass to the start function.|
|ptrArg||Arguments to pass to the start function.|
|stack||Address of initial stack pointer.
Stacks grow downward, so this address should be the highest address in the stack.
|stackSize||Size of the stack in bytes. Used to check whether the stack is in the correct state.|
|priority||Base scheduling priority of thread.
|attr||The attributes of a thread are determined from the
||The new thread is deleted when execution completes.|
||Specify Core 0 to run the thread.|
||Specify Core 1 to run the thread.|
||Specify Core 2 to run the thread.|
||Check for stack usage.|
||Affinity to run on every core.
Do not set thread affinity to
TRUE if the function succeeds. Otherwise,
FALSE (for example, an incorrect priority value).
Creates a new thread. The created thread is initially paused and must be put into the executable state by calling the
This function takes the base (upper address) and size of the stack so that a magic word can be written into the last word of the stack.
OSCheckActiveThreads function checks for stack overflows. If unusual behavior is found in the game program,
check to see whether the value of the position of the word specified in the thread structure's stackEnd.
OS_THREAD_ATTR_DETACHas the value for attr to conform to the Nintendo 64 thread mechanism. This value is set to free the thread control block without failure when thread execution ends. If nothing has been selected as an attribute (if the value of attr equals zero), the operating system continues to use the thread control block until other threads that are joined to this thread using the
OSJoinThreadfunction execute at the end. Accordingly, joined threads receive the return value of the thread that has ended. This return value is also useful for debugging because the thread context can be analyzed in the debugger after the thread has stopped. The detached attribute can also be set for a thread using the
|Multiple threads||This function is not thread-safe.|
2014/04/04 Created attribute table.
2014/01/24 Added Caution to Description block.
2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup pass.
2012/05/25 Matched actual header.
2010/08/30 Initial version.