4600-project-1/inc/globals.hpp

20 lines
529 B
C++
Raw Normal View History

2022-04-04 18:39:30 +00:00
#define N 8
#define timescale 5
//function defines, renaming wait and signal
#define wait(x) sem_wait(&x)
#define signal(x) sem_post(&x)
2022-04-04 18:39:30 +00:00
// Shared memory through global variables
// Create all of memory
extern block memory[N];
// create the three lists
extern list lists[3];
2022-04-05 01:12:40 +00:00
extern list *freelist, *list1, *list2;
// count semaphores
extern sem_t sem_freelist, sem_list1, sem_list2;
2022-04-05 01:12:40 +00:00
// binary semaphores
extern sem_t mut_freelist, mut_list1, mut_list2;
// binary semaphores for reading/writing
extern sem_t mut_take, mut_give;