2.5.2 Thread¶
-
typedef pthread_t ZixThread¶
A thread.
-
typedef void *ZixThreadResult¶
Thread function return type.
-
typedef ZixThreadResult (*ZixThreadFunc)(void*)¶
A thread function.
For portability reasons, the return type varies between platforms, and the return value is ignored. Thread functions should always return
ZIX_THREAD_RESULT
. This allows thread functions to be used directly by the system without any wrapper overhead.“Returning” a result, and communicating with the parent thread in general, can be done through the pointer argument.
-
ZixStatus zix_thread_create(ZixThread *thread, size_t stack_size, ZixThreadFunc function, void *arg)¶
Initialize
thread
to a new thread.The thread will immediately be launched, calling
function
witharg
as the only parameter.
-
ZIX_THREAD_RESULT¶
Result returned from a thread function.
-
ZIX_THREAD_FUNC¶
Thread function attribute.