blob: f78a6e89dba993413b0ce188960903fce2b07837 (
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
29
30
31
32
33
34
35
|
/**
* @file mutex.c
* @author Hanjie Wu (hanjiew)
* @author Devang Acharya (devanga)
* @brief Mutex implementation
* @date 2023-02-22
*
*/
#include <stdint.h>
#include <assert.h>
#include <mutex.h>
/**
* @brief initialize the mutex pointed by mp
*
* @param mp mutex
* @return 0
*/
int mutex_init(mutex_t* mp) {
mp->locked = 0;
mp->w_lock = 0;
mp->w_list = NULL;
return 0;
}
/**
* @brief deactivate the mutex pointed by mp
*
* @param mp mutex
*/
void mutex_destroy(mutex_t* mp) {
affirm(mp->locked == 0);
}
|