libnx
Data Structures | Functions
thread.h File Reference

Multi-threading support. More...

#include "../types.h"

Go to the source code of this file.

Data Structures

struct  Thread
 Thread information structure. More...
 

Functions

Result threadCreate (Thread *t, ThreadFunc entry, void *arg, size_t stack_sz, int prio, int cpuid)
 Creates a thread. More...
 
Result threadStart (Thread *t)
 Starts the execution of a thread. More...
 
Result threadWaitForExit (Thread *t)
 Waits for a thread to finish executing. More...
 
Result threadClose (Thread *t)
 Frees up resources associated with a thread. More...
 
Result threadPause (Thread *t)
 Pauses the execution of a thread. More...
 
Result threadResume (Thread *t)
 Resumes the execution of a thread, after having been paused. More...
 

Detailed Description

Multi-threading support.

Author
plutoo

Function Documentation

Result threadClose ( Thread t)

Frees up resources associated with a thread.

Parameters
tThread information structure.
Returns
Result code.
Result threadCreate ( Thread t,
ThreadFunc  entry,
void *  arg,
size_t  stack_sz,
int  prio,
int  cpuid 
)

Creates a thread.

Parameters
tThread information structure which will be filled in.
entryEntrypoint of the thread.
argArgument to pass to the entrypoint.
stack_szStack size (rounded up to page alignment).
prioThread priority (0x00~0x3F); 0x2C is the usual priority of the main thread.
cpuidID of the core on which to create the thread (0~3); or -2 to use the default core for the current process.
Returns
Result code.
Result threadPause ( Thread t)

Pauses the execution of a thread.

Parameters
tThread information structure.
Returns
Result code.
Warning
This is a privileged operation; in normal circumstances applications cannot use this function.
Result threadResume ( Thread t)

Resumes the execution of a thread, after having been paused.

Parameters
tThread information structure.
Returns
Result code.
Warning
This is a privileged operation; in normal circumstances applications cannot use this function.
Result threadStart ( Thread t)

Starts the execution of a thread.

Parameters
tThread information structure.
Returns
Result code.
Result threadWaitForExit ( Thread t)

Waits for a thread to finish executing.

Parameters
tThread information structure.
Returns
Result code.