20 #ifndef ETCPAL_THREAD_H_
21 #define ETCPAL_THREAD_H_
23 #include "etcpal/error.h"
24 #include "etcpal/os_thread.h"
160 #define ETCPAL_THREAD_SET_DEFAULT_PARAMS(threadparamsptr) \
163 (threadparamsptr)->priority = ETCPAL_THREAD_DEFAULT_PRIORITY; \
164 (threadparamsptr)->stack_size = ETCPAL_THREAD_DEFAULT_STACK; \
165 (threadparamsptr)->thread_name = ETCPAL_THREAD_DEFAULT_NAME; \
166 (threadparamsptr)->platform_data = NULL; \
177 #define ETCPAL_THREAD_PARAMS_INIT_VALUES \
178 ETCPAL_THREAD_DEFAULT_PRIORITY, ETCPAL_THREAD_DEFAULT_STACK, ETCPAL_THREAD_DEFAULT_NAME, NULL
188 #define ETCPAL_THREAD_PARAMS_INIT \
190 ETCPAL_THREAD_PARAMS_INIT_VALUES \
195 void (*thread_fn)(
void*),
202 #if !defined(etcpal_thread_sleep) || DOXYGEN
206 #if !defined(etcpal_thread_get_current_os_handle) || DOXYGEN
etcpal_error_t
A set of error codes that can be returned by library functions.
Definition: error.h:49
struct EtcPalThreadParams EtcPalThreadParams
A set of parameters for an etcpal_thread.
etcpal_error_t etcpal_thread_create(etcpal_thread_t *id, const EtcPalThreadParams *params, void(*thread_fn)(void *), void *thread_arg)
Create a new thread.
etcpal_error_t etcpal_thread_timed_join(etcpal_thread_t *id, int timeout_ms)
Wait for a thread to finish execution, giving up after a timeout.
PLATFORM_DEFINED etcpal_thread_t
The thread handle.
Definition: thread.dox:35
etcpal_error_t etcpal_thread_join(etcpal_thread_t *id)
Wait for a thread to finish execution.
etcpal_error_t etcpal_thread_terminate(etcpal_thread_t *id)
Forcefully kill a thread.
PLATFORM_DEFINED etcpal_thread_os_handle_t
The native OS handle type for threads on this platform.
Definition: thread.dox:42
etcpal_thread_os_handle_t etcpal_thread_get_current_os_handle(void)
Get the native OS handle of the currently executing thread.
void etcpal_thread_sleep(unsigned int sleep_ms)
Provides a platform-neutral sleep.
etcpal_thread_os_handle_t etcpal_thread_get_os_handle(etcpal_thread_t *id)
Get the native OS handle of an EtcPal thread.
A set of parameters for an etcpal_thread.
Definition: thread.h:127
unsigned int priority
The priority of the thread.
Definition: thread.h:129
void * platform_data
Pointer to a platform-specific parameter structure.
Definition: thread.h:156
unsigned int stack_size
The stack size of the thread in bytes.
Definition: thread.h:138
const char * thread_name
A name for the thread, maximum length ETCPAL_THREAD_NAME_MAX_LENGTH.
Definition: thread.h:140