Veritable Lasagna
An Allocator & Data Structure Library for C.
Loading...
Searching...
No Matches
vl_thread.h
Go to the documentation of this file.
1
14#ifndef VL_THREAD_H
15#define VL_THREAD_H
16
17#include "vl_numtypes.h"
18
19#ifndef VL_THREAD_LOCAL
20#define VL_THREAD_LOCAL _Thread_local
21#endif
22
23#ifndef VL_THREAD_NULL
24#define VL_THREAD_NULL 0
25#endif
26
27typedef struct vl_thread_* vl_thread;
28
29typedef void (*vl_thread_proc)(void* usr);
30
51VL_API vl_thread vlThreadNew(vl_thread_proc proc, void* userArg);
52
73VL_API void vlThreadDelete(vl_thread thread);
74
94VL_API vl_bool_t vlThreadJoin(vl_thread thread);
95
116VL_API vl_bool_t vlThreadJoinTimeout(vl_thread thread, vl_uint_t milliseconds);
117
134VL_API vl_thread vlThreadCurrent(void);
135
153VL_API vl_bool_t vlThreadYield(void);
154
170VL_API void vlThreadSleep(vl_ularge_t milliseconds);
171
187VL_API void vlThreadSleepNano(vl_ularge_t nanoseconds);
188
204VL_API void vlThreadExit(void);
205
206#endif // VL_THREAD_H
VL_UINT_T vl_uint_t
Standard unsigned integer type.
Definition vl_numtypes.h:158
VL_BOOL_T vl_bool_t
Definition vl_numtypes.h:191
VL_ULARGE_T vl_ularge_t
Largest available unsigned integer type.
Definition vl_numtypes.h:136
VL_API void vlThreadDelete(vl_thread thread)
Deletes the specified thread handle and its metadata.
Definition vl_thread_pthread.c:113
VL_API vl_thread vlThreadNew(vl_thread_proc proc, void *userArg)
Creates and begins executing a new thread.
Definition vl_thread_pthread.c:73
VL_API vl_bool_t vlThreadYield(void)
Yields the execution of the current thread, allowing another thread to take the remainder of its time...
Definition vl_thread_pthread.c:226
VL_API vl_bool_t vlThreadJoinTimeout(vl_thread thread, vl_uint_t milliseconds)
Attempts to join the specified thread until a maximum amount of time has passed.
Definition vl_thread_pthread.c:152
void(* vl_thread_proc)(void *usr)
Definition vl_thread.h:29
VL_API vl_thread vlThreadCurrent(void)
Gets the current thread.
Definition vl_thread_pthread.c:208
VL_API void vlThreadSleep(vl_ularge_t milliseconds)
Sleeps the current thread a specified total number of milliseconds.
Definition vl_thread_pthread.c:228
VL_API void vlThreadSleepNano(vl_ularge_t nanoseconds)
Sleeps the current thread a specified total number of nanoseconds.
Definition vl_thread_pthread.c:230
VL_API vl_bool_t vlThreadJoin(vl_thread thread)
Joins the specified thread, halting the calling thread until the specified thread exits.
Definition vl_thread_pthread.c:131
VL_API void vlThreadExit(void)
Exits the calling thread.
Definition vl_thread_pthread.c:257