blob: a0a42085f17028092beef2fd718a7f5b54de3334 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/**
* @file mutex.h
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2024-04-27
*
* @copyright Copyright (c) 2024
*
*/
#include <stdbool.h>
typedef struct cel_mutex cel_mutex;
cel_mutex mutex_create();
void mutex_destroy(cel_mutex* mutex);
/** @brief Blocks until the mutex can be acquired. if returns false then an error occurred and can
* be checked (TODO) */
bool mutex_lock(cel_mutex* mutex);
/** @brief Tries to acquire the mutex like `mutex_lock` but returns immediately if the mutex has
* already been locked */
bool mutex_try_lock(cel_mutex* mutex);
/** @brief Releases a mutex. If it is already unlocked then does nothing */
void mutex_unlock(cel_mutex* mutex);
|