Stardew Engine
Loading...
Searching...
No Matches
ThreadSafeQueue.h File Reference
#include "IntTypes.h"
#include "Thread.h"
#include <stdbool.h>
Include dependency graph for ThreadSafeQueue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ThreadSafeQueue
 Fixed size queue that wraps around when full. More...
 

Typedefs

typedef void(* OnTSQueueWrapAroundFn) (void *pItemToBeLost)
 callback for when an item is about to be lost by the queue reaching its maximum size and wrapping around, losing the first item in the queue. An opportunity to properly fre the item in the queue.
 

Functions

void TSQ_Init (struct ThreadSafeQueue *pQueue, u32 itemSize, u32 queueSizeItems, OnTSQueueWrapAroundFn wrapAroundCallback)
 
void TSQ_Enqueue (struct ThreadSafeQueue *pQueue, const void *pIn)
 
bool TSQ_Dequeue (struct ThreadSafeQueue *pQueue, void *pOut)
 

Typedef Documentation

◆ OnTSQueueWrapAroundFn

typedef void(* OnTSQueueWrapAroundFn) (void *pItemToBeLost)

callback for when an item is about to be lost by the queue reaching its maximum size and wrapping around, losing the first item in the queue. An opportunity to properly fre the item in the queue.

Function Documentation

◆ TSQ_Dequeue()

bool TSQ_Dequeue ( struct ThreadSafeQueue pQueue,
void *  pOut 
)
Parameters
pQueue
pOut
Returns
true if something dequeued, false if queue is empty

◆ TSQ_Enqueue()

void TSQ_Enqueue ( struct ThreadSafeQueue pQueue,
const void *  pIn 
)
Parameters
pQueue
pIn

◆ TSQ_Init()

void TSQ_Init ( struct ThreadSafeQueue pQueue,
u32  itemSize,
u32  queueSizeItems,
OnTSQueueWrapAroundFn  wrapAroundCallback 
)
Parameters
pQueue
itemSize
queueSizeItems
wrapAroundCallback