|
libtransistor
A userland library for the Nintendo Switch
|
Threading functions. More...


Go to the source code of this file.
Data Structures | |
| struct | trn_thread_t |
Functions | |
| result_t | trn_thread_create (trn_thread_t *thread, void(*entry)(void *arg), void *arg, uint32_t priority, int32_t processor_id, size_t stack_size, void *stack_bottom) |
| Creates a new thread. More... | |
| result_t | trn_thread_start (trn_thread_t *thread) |
| Starts the given thread. | |
| result_t | trn_thread_cancel_synchronization (trn_thread_t *thread) |
| Cancels synchronization on a thread. More... | |
| result_t | trn_thread_join (trn_thread_t *thread, int64_t timeout) |
| Waits for the given thread to exit. More... | |
| void | trn_thread_destroy (trn_thread_t *thread) |
| Destroys a thread. It is the caller's responsibility to ensure that a living thread is not destroyed. | |
Threading functions.
| result_t trn_thread_cancel_synchronization | ( | trn_thread_t * | thread | ) |
Cancels synchronization on a thread.
If the given thread is currently in a svcWaitSynchronization call, the svcWaitSynchronization call will return 0xec01.
| thread | Thread to cancel synchronization on |
| result_t trn_thread_create | ( | trn_thread_t * | thread, |
| void(*)(void *arg) | entry, | ||
| void * | arg, | ||
| uint32_t | priority, | ||
| int32_t | processor_id, | ||
| size_t | stack_size, | ||
| void * | stack_bottom | ||
| ) |
Creates a new thread.
| thread | Structure to initialize |
| entry | Entry function for thread |
| arg | Second argument to thread entry function |
| priority | Priority of the newly created thread. Must be between 0x00 and 0x3F. Use -1 for same as current thread. |
| processor_id | Which processor the newly created thread will run on. Use -2 for don't care. |
| stack_size | Size of the stack. |
| stack_bottom | Bottom of a pre-allocated stack. If this is NULL, a new stack will be allocated via alloc_pages. |
If stack_bottom is specified, the thread will not take ownership of the stack so as not to make any assumptions about how to free it. If it is NULL, a stack will be allocated via alloc_pages and will be owned by the thread.
| result_t trn_thread_join | ( | trn_thread_t * | thread, |
| int64_t | timeout | ||
| ) |
Waits for the given thread to exit.
| timeout | How long to wait for the thread to exit, in nanoseconds. Use negative value for no timeout. |
1.8.6