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.
This commit is contained in:
parent
feb1743425
commit
66e0279e78
|
@ -12,6 +12,7 @@
|
||||||
// Let the compiler know there will be structs defined elsewhere:
|
// Let the compiler know there will be structs defined elsewhere:
|
||||||
typedef struct queue queue;
|
typedef struct queue queue;
|
||||||
|
|
||||||
|
// An enum which is used to state what type of data is being stored in a queueNode:
|
||||||
typedef enum queueDataType
|
typedef enum queueDataType
|
||||||
{
|
{
|
||||||
EVENT,
|
EVENT,
|
||||||
|
@ -20,6 +21,7 @@ typedef enum queueDataType
|
||||||
OUTPUT_MESSAGE
|
OUTPUT_MESSAGE
|
||||||
} queueDataType;
|
} queueDataType;
|
||||||
|
|
||||||
|
// A union for storing a pointer to all the types of data a queueNode may hold:
|
||||||
typedef union queueData
|
typedef union queueData
|
||||||
{
|
{
|
||||||
outputMessage * outputMessage;
|
outputMessage * outputMessage;
|
||||||
|
@ -27,6 +29,7 @@ typedef union queueData
|
||||||
commandEvent * command;
|
commandEvent * command;
|
||||||
} queueData;
|
} queueData;
|
||||||
|
|
||||||
|
// A queue node, a singly-linked list node for our queue:
|
||||||
typedef struct queueNode queueNode;
|
typedef struct queueNode queueNode;
|
||||||
typedef struct queueNode
|
typedef struct queueNode
|
||||||
{
|
{
|
||||||
|
@ -35,6 +38,7 @@ typedef struct queueNode
|
||||||
queueNode * next;
|
queueNode * next;
|
||||||
} queueNode;
|
} 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
|
typedef struct queue
|
||||||
{
|
{
|
||||||
volatile bool lock;
|
volatile bool lock;
|
||||||
|
|
Loading…
Reference in New Issue