wut  v1.7.0
Wii U Toolchain
Data Structures | Macros | Typedefs | Enumerations | Functions
thread.h File Reference
#include <wut.h>
#include <time.h>
#include "alarm.h"
#include "context.h"
#include "threadqueue.h"
#include "exception.h"
Include dependency graph for thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OSThreadGHSExceptionHandling
 
struct  OSMutexQueue
 
struct  OSFastMutexQueue
 
struct  OSTLSSection
 
struct  OSThread
 

Macros

#define OS_THREAD_TAG   0x74487244u
 

Typedefs

typedef struct OSFastMutex OSFastMutex
 
typedef struct OSFastMutexQueue OSFastMutexQueue
 
typedef struct OSMutex OSMutex
 
typedef struct OSMutexQueue OSMutexQueue
 
typedef struct OSThread OSThread
 
typedef struct OSTLSSection OSTLSSection
 
typedef struct OSThreadGHSExceptionHandling OSThreadGHSExceptionHandling
 
typedef uint8_t OSThreadState
 A value from enum OS_THREAD_STATE. More...
 
typedef uint32_t OSThreadRequest
 A value from enum OS_THREAD_REQUEST. More...
 
typedef uint8_t OSThreadAttributes
 A bitfield of enum OS_THREAD_ATTRIB. More...
 
typedef uint32_t OSThreadType
 A bitfield of enum OS_THREAD_TYPE. More...
 
typedef int(* OSThreadEntryPointFn) (int argc, const char **argv)
 
typedef void(* OSThreadCleanupCallbackFn) (OSThread *thread, void *stack)
 
typedef void(* OSThreadDeallocatorFn) (OSThread *thread, void *stack)
 
typedef enum OSThreadSpecificID OSThreadSpecificID
 

Enumerations

enum  OSThreadSpecificID {
  OS_THREAD_SPECIFIC_0 = 0 ,
  OS_THREAD_SPECIFIC_1 = 1 ,
  OS_THREAD_SPECIFIC_2 = 2 ,
  OS_THREAD_SPECIFIC_3 = 3 ,
  OS_THREAD_SPECIFIC_4 = 4 ,
  OS_THREAD_SPECIFIC_5 = 5 ,
  OS_THREAD_SPECIFIC_6 = 6 ,
  OS_THREAD_SPECIFIC_7 = 7 ,
  OS_THREAD_SPECIFIC_8 = 8 ,
  OS_THREAD_SPECIFIC_9 = 9 ,
  OS_THREAD_SPECIFIC_10 = 10 ,
  OS_THREAD_SPECIFIC_11 = 11 ,
  OS_THREAD_SPECIFIC_12 = 12 ,
  OS_THREAD_SPECIFIC_13 = 13 ,
  OS_THREAD_SPECIFIC_WUT_RESERVED_0 = 14 ,
  OS_THREAD_SPECIFIC_WUT_RESERVED_1 = 15
}
 
enum  OS_THREAD_STATE {
  OS_THREAD_STATE_NONE = 0 ,
  OS_THREAD_STATE_READY = 1 << 0 ,
  OS_THREAD_STATE_RUNNING = 1 << 1 ,
  OS_THREAD_STATE_WAITING = 1 << 2 ,
  OS_THREAD_STATE_MORIBUND = 1 << 3
}
 
enum  OS_THREAD_REQUEST {
  OS_THREAD_REQUEST_NONE = 0 ,
  OS_THREAD_REQUEST_SUSPEND = 1 ,
  OS_THREAD_REQUEST_CANCEL = 2
}
 
enum  OS_THREAD_ATTRIB {
  OS_THREAD_ATTRIB_AFFINITY_CPU0 = 1 << 0 ,
  OS_THREAD_ATTRIB_AFFINITY_CPU1 = 1 << 1 ,
  OS_THREAD_ATTRIB_AFFINITY_CPU2 = 1 << 2 ,
  OS_THREAD_ATTRIB_AFFINITY_ANY = ((1 << 0) | (1 << 1) | (1 << 2)) ,
  OS_THREAD_ATTRIB_DETACHED = 1 << 3 ,
  OS_THREAD_ATTRIB_STACK_USAGE = 1 << 5 ,
  OS_THREAD_ATTRIB_UNKNOWN = 1 << 7
}
 
enum  OS_THREAD_TYPE {
  OS_THREAD_TYPE_DRIVER = 0 ,
  OS_THREAD_TYPE_IO = 1 ,
  OS_THREAD_TYPE_APP = 2
}
 

Functions

void OSCancelThread (OSThread *thread)
 Cancels a thread. More...
 
int32_t OSCheckActiveThreads ()
 Returns the count of active threads. More...
 
int32_t OSCheckThreadStackUsage (OSThread *thread)
 Get the maximum amount of stack the thread has used. More...
 
void OSClearThreadStackUsage (OSThread *thread)
 Disable tracking of thread stack usage. More...
 
void OSContinueThread (OSThread *thread)
 Clears a thread's suspend counter and resumes it. More...
 
BOOL OSCreateThread (OSThread *thread, OSThreadEntryPointFn entry, int32_t argc, char *argv, void *stack, uint32_t stackSize, int32_t priority, OSThreadAttributes attributes)
 Create a new thread. More...
 
void OSDetachThread (OSThread *thread)
 Detach thread. More...
 
void OSExitThread (int32_t result)
 Exit the current thread with a exit code. More...
 
void OSGetActiveThreadLink (OSThread *thread, OSThreadLink *link)
 Get the next and previous thread in the thread's active queue. More...
 
OSThreadOSGetCurrentThread ()
 Return pointer to OSThread object for the current thread. More...
 
OSThreadOSGetDefaultThread (uint32_t coreID)
 Returns the default thread for a specific core. More...
 
uint32_t OSGetStackPointer ()
 Return current stack pointer, value of r1 register. More...
 
uint32_t OSGetThreadAffinity (OSThread *thread)
 Get a thread's affinity. More...
 
const char * OSGetThreadName (OSThread *thread)
 Get a thread's name. More...
 
int32_t OSGetThreadPriority (OSThread *thread)
 Get a thread's base priority. More...
 
void * OSGetThreadSpecific (OSThreadSpecificID id)
 Get a thread's specific value set by OSSetThreadSpecific. More...
 
BOOL OSIsThreadSuspended (OSThread *thread)
 Returns TRUE if a thread is suspended. More...
 
BOOL OSIsThreadTerminated (OSThread *thread)
 Returns TRUE if a thread is terminated. More...
 
BOOL OSJoinThread (OSThread *thread, int *threadResult)
 Wait until thread is terminated. More...
 
int32_t OSResumeThread (OSThread *thread)
 Resumes a thread. More...
 
BOOL OSRunThread (OSThread *thread, OSThreadEntryPointFn entry, int argc, const char **argv)
 Run a function on an already created thread. More...
 
BOOL OSSetThreadAffinity (OSThread *thread, uint32_t affinity)
 Set a thread's affinity. More...
 
BOOL OSSetThreadCancelState (BOOL state)
 Set a thread's cancellation state. More...
 
OSThreadCleanupCallbackFn OSSetThreadCleanupCallback (OSThread *thread, OSThreadCleanupCallbackFn callback)
 Set the callback to be called just before a thread is terminated. More...
 
OSThreadDeallocatorFn OSSetThreadDeallocator (OSThread *thread, OSThreadDeallocatorFn deallocator)
 Set the callback to be called just after a thread is terminated. More...
 
void OSSetThreadName (OSThread *thread, const char *name)
 Set a thread's name. More...
 
BOOL OSSetThreadPriority (OSThread *thread, int32_t priority)
 Set a thread's priority. More...
 
BOOL OSSetThreadRunQuantum (OSThread *thread, uint32_t quantum)
 Set a thread's run quantum. More...
 
void OSSetThreadSpecific (OSThreadSpecificID id, void *value)
 Set a thread specific value. More...
 
BOOL OSSetThreadStackUsage (OSThread *thread)
 Set thread stack usage tracking. More...
 
void OSSleepThread (OSThreadQueue *queue)
 Sleep the current thread and add it to a thread queue. More...
 
void OSSleepTicks (OSTime ticks)
 Sleep the current thread for a period of time. More...
 
uint32_t OSSuspendThread (OSThread *thread)
 Suspend a thread. More...
 
void __OSSuspendThreadNolock (OSThread *thread)
 
void OSTestThreadCancel ()
 Check to see if the current thread should be cancelled or suspended. More...
 
void OSWakeupThread (OSThreadQueue *queue)
 Wake up all threads in queue. More...
 
void OSYieldThread ()
 Yield execution to waiting threads with same priority. More...