Veritable Lasagna
An Allocator & Data Structure Library for C.
Loading...
Searching...
No Matches
vl_thread_win32.c File Reference
#include <process.h>
#include <windows.h>
+ Include dependency graph for vl_thread_win32.c:

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

vl_thread vlThreadNew (vl_thread_proc threadProc, void *userArg)
 Creates and begins executing a new thread.
 
void vlThreadDelete (vl_thread thread)
 Deletes the specified thread.
 
vl_bool_t vlThreadJoin (vl_thread thread)
 Joins the specified thread, halting the calling thread until the specified thread exits.
 
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.
 
vl_thread vlThreadCurrent ()
 Gets the current thread.
 
vl_bool_t vlThreadYield ()
 Yields the execution of the current thread, allowing another thread to take the remainder of its timeslice.
 
void vlThreadSleep (vl_ularge_t milliseconds)
 Sleeps the current thread a specified total number of milliseconds.
 
void vlThreadSleepNano (vl_ularge_t nanoseconds)
 Sleeps the current thread a specified total number of nanoseconds.
 
void vlThreadExit ()
 Exits the calling thread.
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Function Documentation

◆ vlThreadCurrent()

vl_thread vlThreadCurrent ( )

Gets the current thread.

Returns
vl_thread representing the current thread.
+ Here is the caller graph for this function:

◆ vlThreadDelete()

void vlThreadDelete ( vl_thread thread)

Deletes the specified thread.

Warning
This will result in undefined behavior if the thread has not been joined prior to calling this function.
See also
vlThreadJoin
vlThreadJoinTimeout
Parameters
threadwhich thread to delete

◆ vlThreadExit()

void vlThreadExit ( )

Exits the calling thread.

Note
Does not return to the caller.

◆ vlThreadJoin()

vl_bool_t vlThreadJoin ( vl_thread thread)

Joins the specified thread, halting the calling thread until the specified thread exits.

Note
If the specified thread happens to be the main thread, this will return false.
Parameters
thread
Returns
true on success, false on error.

◆ vlThreadJoinTimeout()

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.

Note
Will always return false is trying to join the main thread.
Parameters
thread
milliseconds
Returns
true on success, false on timeout or error.

◆ vlThreadNew()

vl_thread vlThreadNew ( vl_thread_proc threadProc,
void * userArg )

Creates and begins executing a new thread.

Note
May return VL_THREAD_NULL on failure.
Parameters
userArgargument pointer
Returns
thread handle
+ Here is the call graph for this function:

◆ vlThreadSleep()

void vlThreadSleep ( vl_ularge_t milliseconds)

Sleeps the current thread a specified total number of milliseconds.

Parameters
milliseconds

◆ vlThreadSleepNano()

void vlThreadSleepNano ( vl_ularge_t nanoseconds)

Sleeps the current thread a specified total number of nanoseconds.

Parameters
nanoseconds

◆ vlThreadYield()

vl_bool_t vlThreadYield ( )

Yields the execution of the current thread, allowing another thread to take the remainder of its timeslice.

Returns
a boolean indicating if the yield operation occurred. May return false if there is no other thread to yield to.