mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 17:05:50 +00:00
31 lines
1.0 KiB
C
31 lines
1.0 KiB
C
#pragma once
|
|
|
|
#include "Platform.h"
|
|
#include "PlatformThreads.h"
|
|
|
|
#define LBQ_SUCCESS 0
|
|
#define LBQ_INTERRUPTED 1
|
|
#define LBQ_BOUND_EXCEEDED 2
|
|
#define LBQ_NO_MEMORY 3
|
|
|
|
typedef struct _LINKED_BLOCKING_QUEUE_ENTRY {
|
|
struct _LINKED_BLOCKING_QUEUE_ENTRY *flink;
|
|
struct _LINKED_BLOCKING_QUEUE_ENTRY *blink;
|
|
void* data;
|
|
} LINKED_BLOCKING_QUEUE_ENTRY, *PLINKED_BLOCKING_QUEUE_ENTRY;
|
|
|
|
typedef struct _LINKED_BLOCKING_QUEUE {
|
|
PLT_MUTEX mutex;
|
|
PLT_EVENT containsDataEvent;
|
|
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);
|
|
int LbqOfferQueueItem(PLINKED_BLOCKING_QUEUE queueHead, void* data);
|
|
int LbqWaitForQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data);
|
|
PLINKED_BLOCKING_QUEUE_ENTRY LbqDestroyLinkedBlockingQueue(PLINKED_BLOCKING_QUEUE queueHead);
|
|
PLINKED_BLOCKING_QUEUE_ENTRY LbqFlushQueueItems(PLINKED_BLOCKING_QUEUE queueHead);
|