4600-project-1/inc/globals.hpp

22 lines
584 B
C++

#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 lists[3];
extern list *freelist, *list1, *list2;
// count semaphores
extern sem_t sem_freelist, sem_list1, sem_list2;
// binary semaphores
extern sem_t mut_freelist, mut_list1, mut_list2;