From 66e0279e781fef6e6f7a3f6732c0e56084c50999 Mon Sep 17 00:00:00 2001 From: Barry Kane Date: Sat, 11 Feb 2023 00:07:30 +0000 Subject: [PATCH] Commented the data structures in queue.h. - Commented all the data structures in queue, to make it slightly clearer as to their usage and what they store. --- src/queue.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/queue.h b/src/queue.h index 797c173..3217698 100644 --- a/src/queue.h +++ b/src/queue.h @@ -12,6 +12,7 @@ // Let the compiler know there will be structs defined elsewhere: typedef struct queue queue; +// An enum which is used to state what type of data is being stored in a queueNode: typedef enum queueDataType { EVENT, @@ -20,6 +21,7 @@ typedef enum queueDataType OUTPUT_MESSAGE } queueDataType; +// A union for storing a pointer to all the types of data a queueNode may hold: typedef union queueData { outputMessage * outputMessage; @@ -27,6 +29,7 @@ typedef union queueData commandEvent * command; } queueData; +// A queue node, a singly-linked list node for our queue: typedef struct queueNode queueNode; typedef struct queueNode { @@ -35,6 +38,7 @@ typedef struct queueNode queueNode * next; } queueNode; +// A queue, with pointers to the head and tail of the linked list, and data for multi-threading, locking, and an item count. typedef struct queue { volatile bool lock;