File ThreadSafeQueue.h

FileList > engine > include > ThreadSafeQueue.h

Go to the source code of this file

  • #include "IntTypes.h"
  • #include "Thread.h"
  • #include <stdbool.h>

Classes

Type Name
struct ThreadSafeQueue
Fixed size queue that wraps around when full.

Public Types

Type Name
typedef void(* OnTSQueueWrapAroundFn
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.

Public Functions

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

Public Types Documentation

typedef OnTSQueueWrapAroundFn

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.

typedef void(* OnTSQueueWrapAroundFn) (void *pItemToBeLost);

Public Functions Documentation

function TSQ_Dequeue

bool TSQ_Dequeue (
    struct ThreadSafeQueue * pQueue,
    void * pOut
) 

Parameters:

  • pQueue
  • pOut

Returns:

true if something dequeued, false if queue is empty


function TSQ_Enqueue

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

Parameters:

  • pQueue
  • pIn

function TSQ_Init

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

Parameters:

  • pQueue
  • itemSize
  • queueSizeItems
  • wrapAroundCallback


The documentation for this class was generated from the following file /home/runner/work/2DFarmingRPG/2DFarmingRPG/Stardew/engine/include/ThreadSafeQueue.h