Provides mutexes which are used to synchronize threads and uber-mutexes which are used to synchronize processes.
More...
#include <kinc/global.h>
#include <kinc/backend/mutex.h>
#include <stdbool.h>
Go to the source code of this file.
|
| KINC_FUNC void | kinc_mutex_init (kinc_mutex_t *mutex) |
| | Initializes a mutex-object.
|
| KINC_FUNC void | kinc_mutex_destroy (kinc_mutex_t *mutex) |
| | Destroys a mutex-object.
|
| KINC_FUNC void | kinc_mutex_lock (kinc_mutex_t *mutex) |
| | Locks a mutex. A mutex can only be locked from one thread - when other threads attempt to lock the mutex the function will only return once the mutex has been unlocked.
|
| KINC_FUNC bool | kinc_mutex_try_to_lock (kinc_mutex_t *mutex) |
| | Attempts to lock the mutex which will only succeed if no other thread currently holds the lock.
|
| KINC_FUNC void | kinc_mutex_unlock (kinc_mutex_t *mutex) |
| | Unlocks the mutex which then allows other threads to lock it.
|
| KINC_FUNC bool | kinc_uber_mutex_init (kinc_uber_mutex_t *mutex, const char *name) |
| | Initializes an uber-mutex-object.
|
| KINC_FUNC void | kinc_uber_mutex_destroy (kinc_uber_mutex_t *mutex) |
| | Destroys an uber-mutex-obejct.
|
| KINC_FUNC void | kinc_uber_mutex_lock (kinc_uber_mutex_t *mutex) |
| | Locks an uber-mutex.
|
| KINC_FUNC void | kinc_uber_mutex_unlock (kinc_uber_mutex_t *mutex) |
| | Unlocks an uber-mutex.
|
Provides mutexes which are used to synchronize threads and uber-mutexes which are used to synchronize processes.
◆ kinc_mutex_destroy()
| KINC_FUNC void kinc_mutex_destroy |
( |
kinc_mutex_t * | mutex | ) |
|
Destroys a mutex-object.
- Parameters
-
| mutex | The mutex to destroy |
◆ kinc_mutex_init()
| KINC_FUNC void kinc_mutex_init |
( |
kinc_mutex_t * | mutex | ) |
|
Initializes a mutex-object.
- Parameters
-
| mutex | The mutex to initialize |
◆ kinc_mutex_lock()
| KINC_FUNC void kinc_mutex_lock |
( |
kinc_mutex_t * | mutex | ) |
|
Locks a mutex. A mutex can only be locked from one thread - when other threads attempt to lock the mutex the function will only return once the mutex has been unlocked.
- Parameters
-
◆ kinc_mutex_try_to_lock()
| KINC_FUNC bool kinc_mutex_try_to_lock |
( |
kinc_mutex_t * | mutex | ) |
|
Attempts to lock the mutex which will only succeed if no other thread currently holds the lock.
- Parameters
-
- Returns
- Whether the mutex could be locked
◆ kinc_mutex_unlock()
| KINC_FUNC void kinc_mutex_unlock |
( |
kinc_mutex_t * | mutex | ) |
|
Unlocks the mutex which then allows other threads to lock it.
- Parameters
-
◆ kinc_uber_mutex_destroy()
| KINC_FUNC void kinc_uber_mutex_destroy |
( |
kinc_uber_mutex_t * | mutex | ) |
|
Destroys an uber-mutex-obejct.
- Parameters
-
| mutex | The uber-mutex to destroy |
◆ kinc_uber_mutex_init()
| KINC_FUNC bool kinc_uber_mutex_init |
( |
kinc_uber_mutex_t * | mutex, |
|
|
const char * | name ) |
Initializes an uber-mutex-object.
- Parameters
-
| mutex | The uber-mutex to initialize |
| name | A name assigned to the uber-mutex - uber-mutex-creation fails if an uber-mutex of that name already exists |
- Returns
- Whether the uber-mutex could be created
◆ kinc_uber_mutex_lock()
| KINC_FUNC void kinc_uber_mutex_lock |
( |
kinc_uber_mutex_t * | mutex | ) |
|
Locks an uber-mutex.
- Parameters
-
| mutex | The uber-mutex to lock |
◆ kinc_uber_mutex_unlock()
| KINC_FUNC void kinc_uber_mutex_unlock |
( |
kinc_uber_mutex_t * | mutex | ) |
|
Unlocks an uber-mutex.
- Parameters
-
| mutex | The uber-mutex to unlock |
- Returns