Make variable names more accurate

Make functions more functional
Make comments more commentary
This commit is contained in:
2022-04-05 15:37:42 -05:00
parent 927b209cef
commit 478778841e
8 changed files with 108 additions and 58 deletions

View File

@@ -1,4 +1,10 @@
#define N 8
#define timescale 5
//function defines, renaming wait and signal
#define wait(x) sem_wait(&x)
#define signal(x) sem_post(&x)
// Shared memory through global variables
// Create all of memory
extern block memory[N];
@@ -7,6 +13,8 @@ extern list lists[3];
extern list *freelist, *list1, *list2;
// count semaphores
extern sem_t semfl, seml1, seml2;
extern sem_t sem_freelist, sem_list1, sem_list2;
// binary semaphores
extern sem_t mutfl, mutl1, mutl2;
extern sem_t mut_freelist, mut_list1, mut_list2;
// binary semaphores for reading/writing
extern sem_t mut_take, mut_give;

View File

@@ -14,7 +14,7 @@ struct list {
// list operations:
// list_unlink: unlinks the last block in the list, and returns a pointer to it
block *list_unlink (list *l);
block* list_unlink (list* l, bool lastblock=0);
// list_link: links the block b onto the end of the list
void list_link (list *l, block *b);
// list_init: links an array of blocks onto the end of a list