mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 14:21:30 +00:00
Use a double-linked list for the linked blocking queue so insertions are done in O(1) time
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
#define LBQ_NO_MEMORY 3
|
||||
|
||||
typedef struct _LINKED_BLOCKING_QUEUE_ENTRY {
|
||||
struct _LINKED_BLOCKING_QUEUE_ENTRY *next;
|
||||
struct _LINKED_BLOCKING_QUEUE_ENTRY *flink;
|
||||
struct _LINKED_BLOCKING_QUEUE_ENTRY *blink;
|
||||
void* data;
|
||||
} LINKED_BLOCKING_QUEUE_ENTRY, *PLINKED_BLOCKING_QUEUE_ENTRY;
|
||||
|
||||
@@ -19,6 +20,7 @@ typedef struct _LINKED_BLOCKING_QUEUE {
|
||||
int sizeBound;
|
||||
int currentSize;
|
||||
PLINKED_BLOCKING_QUEUE_ENTRY head;
|
||||
PLINKED_BLOCKING_QUEUE_ENTRY tail;
|
||||
} LINKED_BLOCKING_QUEUE, *PLINKED_BLOCKING_QUEUE;
|
||||
|
||||
int LbqInitializeLinkedBlockingQueue(PLINKED_BLOCKING_QUEUE queueHead, int sizeBound);
|
||||
|
||||
Reference in New Issue
Block a user