summaryrefslogtreecommitdiff
path: root/user/inc/sem_type.h
blob: c0bdf56d23c2890813f569b243d17da2ab947fac (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
/**
 * @file sem.h
 * @author Hanjie Wu (hanjiew)
 * @author Devang Acharya (devanga)
 * @brief semaphore structure
 * @date 2023-02-22
 *
 */
#ifndef SEM_TYPE_H
#define SEM_TYPE_H

#include <cond.h>
#include <mutex.h>

/**
 * @brief semaphore structure
 */
typedef struct sem_s {
    int value;
    mutex_t value_lock; /* mutex to protect the value */
    cond_t value_cv;    /* cv to wait for value increment */
} sem_t;

#endif