summaryrefslogtreecommitdiff
path: root/user/inc/cond_type.h
blob: 41e56f48c3187f8e8efabfe1f18f1834a6e29696 (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
/**
 * @file cond_type.h
 * @author Hanjie Wu (hanjiew)
 * @author Devang Acharya (devanga)
 * @brief cv structure
 * @date 2023-02-22
 *
 */
#ifndef COND_TYPE_H
#define COND_TYPE_H

#include <mutex.h>

/**
 * @brief a node in condition vairable wait queue
 */
typedef struct cond_node_s {
    int tid;
    int signaled; /* is this thread signaled by othres */
    struct cond_node_s* next;
    struct cond_node_s* prev;
} cond_node_t;

/**
 * @brief condition vairable
 */
typedef struct cond_s {
    mutex_t lock;
    cond_node_t* queue; /* waiters on this cv */
} cond_t;

#endif