Implement prerequisites
This commit is contained in:
		
							
								
								
									
										2
									
								
								inc/consumer.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								inc/consumer.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
 | 
			
		||||
void consumer ();
 | 
			
		||||
							
								
								
									
										7
									
								
								inc/globals.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								inc/globals.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
#define N 8
 | 
			
		||||
// 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;
 | 
			
		||||
							
								
								
									
										24
									
								
								inc/list.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								inc/list.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
 | 
			
		||||
struct block {
 | 
			
		||||
   block *prev;
 | 
			
		||||
   block *next;
 | 
			
		||||
   // data goes here
 | 
			
		||||
   int data;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct list {
 | 
			
		||||
   block *start;
 | 
			
		||||
   block *end;
 | 
			
		||||
   int length;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// list operations:
 | 
			
		||||
//   list_unlink: unlinks the last block in the list, and returns a pointer to it
 | 
			
		||||
block *list_unlink (list *l);
 | 
			
		||||
//   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
 | 
			
		||||
void   list_init   (list *l, block *m, int size);
 | 
			
		||||
//   list_print:  prints a list
 | 
			
		||||
void   list_print  (list *l);
 | 
			
		||||
void   list_concise(list *l);
 | 
			
		||||
							
								
								
									
										2
									
								
								inc/producer.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								inc/producer.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
 | 
			
		||||
void producer ();
 | 
			
		||||
							
								
								
									
										2
									
								
								inc/transformer.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								inc/transformer.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
 | 
			
		||||
void transformer ();
 | 
			
		||||
		Reference in New Issue
	
	Block a user