chsvlib
chsv helper source code

◆ chsv_thrd_create()

int Chusov::ExecutionControl::chsv_thrd_create ( chsv_thrd_t pThread,
chsv_thrd_start_t  pStartAddress,
void *  pArg 
)
noexcept

Creates a new thread executing the specified function with the specified argument.

Parameters
[in]pThreadis a pointer to a buffer receiving a thread identifier.
[in]pStartAddressis a chsv_thrd_start_t pointer to a function that is executed be the newly created thread.
[in]pArgis an optional pointer to an argument passed to the pStartAddress "as-is".
Returns
On success the function returns chsv_thrd_success. The function can fail because of insufficient memory available at the time of the call. In this case the function returns chsv_thrd_nomem and sets errno to ENOMEM. If function fails for any other reason the function sets the corresponding errno code and returns chsv_thrd_error.

The completion of the chsv_thrd_create function synchronizes with the beginning of the execution of the new thread.

The function implements a behaviour of the thrd_create function defined in the ISO/IEC 9899:2011 (aka C11) standard.

See also
chsv_thrd_detach;
chsv_thrd_join;
chsv_thrd_current;
chsv_thrd_exit.