Make variable names more accurate
Make functions more functional Make comments more commentary
This commit is contained in:
		@@ -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;
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user