forked from cindywhan/cosc301_proj04
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fifoq.h
48 lines (30 loc) · 969 Bytes
/
fifoq.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <ucontext.h>
#include "threadsalive.h"
#ifndef __FIFO_H__
#define __FIFO_H__
struct node {
ucontext_t thread;
int tid;
struct node* next;
};
struct locknode {
talock_t *lock;
struct locknode* next;
};
struct semnode {
tasem_t *sem;
struct semnode* next;
};
void node_init(struct node* ready);
void fifo_print(struct node *ready);
void fifo_clear(struct node *ready);
struct node* fifo_pop(struct node **ready);
void fifo_push(struct node **ready, struct node *thread);
void node_destroy(struct node *ready);
void locknode_push(struct locknode **locklist, struct locknode *lock);
struct locknode* locknode_pop(struct locknode **locklist);
void semnode_push(struct semnode **semlist, struct semnode *sem);
struct semnode* semnode_pop(struct semnode **semlist);
struct locknode* locknode_remove(struct locknode **locklist, int lockid);
struct semnode* semnode_remove(struct semnode **semlist, int semid);
#endif // __FIFO_H__