4600-project-1/inc/globals.hpp
2022-04-06 01:45:57 -05:00

28 lines
855 B
C++

/*
+-------------+---------+-----------------------+
| John Breaux | jab0910 | JohnBreaux@my.unt.edu |
+-------------+---------+-----------------------+
| 2022-04-04 |
+-----------------------------------------------+
*/
#define N 8
#define timescale 10000
//function defines, renaming wait and signal
#define wait(x) sem_wait(&x)
#define signal(x) sem_post(&x)
// renaming link and unlink to match pseudocode semantics
#define link(x,y) list_link(y,x)
#define unlink(x) list_unlink(x)
// Shared memory through global variables
// Create all of memory
extern block memory[N];
// create the three lists
extern list *freelist, *list1, *list2;
// count semaphores
extern sem_t sem_freelist, sem_list1, sem_list2, sem_freelist_minus_1;
// binary semaphores
extern sem_t mut_freelist, mut_list1, mut_list2;