Threading.
Threads | Threading. |
Types | |
nacore_thread | Thread identifier. |
Functions | |
nacore_thread_create() | Creates a new thread. |
nacore_thread_exit() | Terminates the calling thread. |
nacore_thread_self() | Gets an identifier for the calling thread. |
nacore_thread_join() | Waits for termination of the specified thread. |
nacore_thread_equal() | Compares two thread identifiers. |
Thread identifier.
It is unspecified whether nacore_thread is a pointer, a structure or whatever.
Two thread identifiers can only be compared using nacore_thread_equal().
_NACORE_DEF int nacore_thread_create( nacore_thread * thread, size_t stack_size, void (*start_routine)(void *arg), void * arg )
Creates a new thread.
thread | Memory location where to put a thread identifier. |
size | Stack size for the new thread or 0 to indicate the default stack size. |
start_routine | Function to be executed by the new thread. |
arg | Argument to be passed to start_routine or NULL. |
0 on success, ENOMEM if there was not enough memory, EINVAL if the system cannot allocate the requested stack size, EAGAIN if the system lacked the necessary resources or EPERM if the caller does not have appropriate permission.
_NACORE_DEF int nacore_thread_join( nacore_thread thread )
Waits for termination of the specified thread.
thread | Thread identifier. |
0 on success. Depending on the platform, in case of error it may return EDEADLK if thread is the calling thread or if a deadlock was detected, EINVAL if the specified thread is not joinable or another thread is already waiting to join with it, ESRCH if no thead corresponding to the given thread identifier was found or NACORE_EUNKNOWN if another kind of error happened.
Creates a new thread.
_NACORE_DEF int nacore_thread_create( nacore_thread * thread, size_t stack_size, void (*start_routine)(void *arg), void * arg )
Terminates the calling thread.
_NACORE_DEF void nacore_thread_exit()
Gets an identifier for the calling thread.
_NACORE_DEF nacore_thread nacore_thread_self()
Waits for termination of the specified thread.
_NACORE_DEF int nacore_thread_join( nacore_thread thread )
Compares two thread identifiers.
_NACORE_DEF char nacore_thread_equal( nacore_thread t1, nacore_thread t2 )