Typedefs | |
typedef implementation_defined | os_thread_t |
Functions | |
int | os_thread_create (os_thread_t *thread, const char *name, void(*func)(void *), void *arg) |
void | os_thread_stop (os_thread_t *thread, os_event_t *evt) |
int | os_thread_should_stop (os_thread_t *thread) |
void | os_try_suspend_thread (os_thread_t *thread) |
typedef implementation_defined os_thread_t |
Implementation defined thread object.
int os_thread_create | ( | os_thread_t * | thread, | |
const char * | name, | |||
void(*)(void *) | func, | |||
void * | arg | |||
) |
Create and start a thread.
The thread function should call os_thread_should_stop() and return when it returns true.
Callable from: thread context.
thread | pointer to OS-specific thread data. | |
name | thread name. | |
func | thread entry-point function. | |
arg | argument for func. |
int os_thread_should_stop | ( | os_thread_t * | thread | ) |
Return true if the thread should stop (as signalled by a call to os_thread_stop()).
thread | the thread to check. |
void os_thread_stop | ( | os_thread_t * | thread, | |
os_event_t * | evt | |||
) |
Stop a thread and wait for it to exit.
If evt is non-NULL it will be posted to awaken the thread. The thread will also be awakened if it's asleep (in a os_sleep_ms() call for example).
Callable from: thread context.
thread | the thread to stop. | |
evt | a event to raise to awaken the thread, may be NULL. |
void os_try_suspend_thread | ( | os_thread_t * | thread | ) |
Try to suspend a thread.
This specifies a point where it is safe for a thread to be suspended.
Callable from: thread context.
thread | pointer to OS-specific thread data. |