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

Functions

vl_mutex vlMutexNew ()
 Creates a new instance of a mutex.
 
void vlMutexDelete (vl_mutex mutex)
 Deletes the specified mutex.
 
void vlMutexObtainShared (vl_mutex mutex)
 Obtain a shared lock on the specified mutex.
 
vl_bool_t vlMutexTryObtainShared (vl_mutex mutex)
 Attempts to obtain a shared lock from the specified mutex.
 
void vlMutexReleaseShared (vl_mutex mutex)
 Releases a shared lock on the specified mutex.
 
void vlMutexObtainExclusive (vl_mutex mutex)
 Obtains an exclusive lock on the specified mutex.
 
vl_bool_t vlMutexTryObtainExclusive (vl_mutex mutex)
 Attempts to obtain an exclusive lock on the specified mutex.
 
void vlMutexReleaseExclusive (vl_mutex mutex)
 Releases an exclusive lock on the specified mutex.
 

Function Documentation

◆ vlMutexDelete()

void vlMutexDelete ( vl_mutex mutex)

Deletes the specified mutex.

Warning
Be certain the mutex is no longer obtained by the time this function is called.

◆ vlMutexNew()

vl_mutex vlMutexNew ( )

Creates a new instance of a mutex.

Note
May return VL_MUTEX_NULL on failure.
Returns
mutex handle

◆ vlMutexObtainExclusive()

void vlMutexObtainExclusive ( vl_mutex mutex)

Obtains an exclusive lock on the specified mutex.

Only a single thread may obtain an exclusive lock at any given time. This is more suitable for write operations.

Parameters
mutex

◆ vlMutexObtainShared()

void vlMutexObtainShared ( vl_mutex mutex)

Obtain a shared lock on the specified mutex.

Multiple threads may obtain a shared lock at any given time. This is more suitable for concurrent read operations.

Parameters
mutex

◆ vlMutexReleaseExclusive()

void vlMutexReleaseExclusive ( vl_mutex mutex)

Releases an exclusive lock on the specified mutex.

Parameters
mutex

◆ vlMutexReleaseShared()

void vlMutexReleaseShared ( vl_mutex mutex)

Releases a shared lock on the specified mutex.

Parameters
mutex

◆ vlMutexTryObtainExclusive()

vl_bool_t vlMutexTryObtainExclusive ( vl_mutex mutex)

Attempts to obtain an exclusive lock on the specified mutex.

Note
This function is non-blocking.
Parameters
mutex
Returns
a boolean indicating whether or not the lock was obtained.

◆ vlMutexTryObtainShared()

vl_bool_t vlMutexTryObtainShared ( vl_mutex mutex)

Attempts to obtain a shared lock from the specified mutex.

Note
This function is non-blocking.
Parameters
mutex
Returns
a boolean indicating whether or not the shared lock was obtained