Loading...
Searching...
No Matches
Data Structures | Macros | Functions
as_queue_mt.h File Reference
#include <aerospike/as_queue.h>
#include <aerospike/as_std.h>
#include <pthread.h>
+ Include dependency graph for as_queue_mt.h:

Go to the source code of this file.

Data Structures

struct  as_queue_mt
 

Macros

#define AS_QUEUE_FOREVER   -1
 
#define as_queue_mt_inita(__q, __item_size, __capacity)
 
#define AS_QUEUE_NOWAIT   0
 

Functions

AS_EXTERN as_queue_mtas_queue_mt_create (uint32_t item_size, uint32_t capacity)
 
static void as_queue_mt_destroy (as_queue_mt *queue)
 
static bool as_queue_mt_empty (as_queue_mt *queue)
 
AS_EXTERN bool as_queue_mt_init (as_queue_mt *queue, uint32_t item_size, uint32_t capacity)
 
AS_EXTERN bool as_queue_mt_pop (as_queue_mt *queue, void *ptr, int wait_ms)
 
AS_EXTERN bool as_queue_mt_pop_tail (as_queue_mt *queue, void *ptr, int wait_ms)
 
static bool as_queue_mt_push (as_queue_mt *queue, const void *ptr)
 
static bool as_queue_mt_push_head (as_queue_mt *queue, const void *ptr)
 
static bool as_queue_mt_push_head_limit (as_queue_mt *queue, const void *ptr)
 
static bool as_queue_mt_push_limit (as_queue_mt *queue, const void *ptr)
 
static uint32_t as_queue_mt_size (as_queue_mt *queue)
 

Macro Definition Documentation

◆ AS_QUEUE_FOREVER

#define AS_QUEUE_FOREVER   -1

Definition at line 56 of file as_queue_mt.h.

◆ as_queue_mt_inita

#define as_queue_mt_inita ( __q,
__item_size,
__capacity )
Value:
as_queue_inita(&(__q)->queue, __item_size, __capacity);\
pthread_mutex_init(&(__q)->lock, NULL);\
pthread_cond_init(&(__q)->cond, NULL);
#define as_queue_inita(__q, __item_size, __capacity)
Definition as_queue.h:80

Initialize a stack allocated as_queue_mt, with item storage on the stack. as_queue_mt_inita() will transfer stack memory to the heap if a resize is required.

Definition at line 64 of file as_queue_mt.h.

◆ AS_QUEUE_NOWAIT

#define AS_QUEUE_NOWAIT   0

Definition at line 57 of file as_queue_mt.h.

Function Documentation

◆ as_queue_mt_create()

AS_EXTERN as_queue_mt * as_queue_mt_create ( uint32_t item_size,
uint32_t capacity )

Create a heap allocated as_queue, with item storage on the heap.

◆ as_queue_mt_destroy()

static void as_queue_mt_destroy ( as_queue_mt * queue)
inlinestatic

Release queue memory.

Definition at line 89 of file as_queue_mt.h.

References as_queue_destroy(), as_queue_mt::cond, as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_empty()

static bool as_queue_mt_empty ( as_queue_mt * queue)
inlinestatic

Is queue empty?

Definition at line 112 of file as_queue_mt.h.

References as_queue_empty(), as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_init()

AS_EXTERN bool as_queue_mt_init ( as_queue_mt * queue,
uint32_t item_size,
uint32_t capacity )

Initialize a stack allocated as_queue, with item storage on the heap.

◆ as_queue_mt_pop()

AS_EXTERN bool as_queue_mt_pop ( as_queue_mt * queue,
void * ptr,
int wait_ms )

Pop from the head of the queue.

If the queue is empty, wait_ms is the maximum time in milliseconds to wait for an available entry. If wait_ms is AS_QUEUE_FOREVER (-1), the wait time will be forever. If wait_ms is AS_QUEUE_NOWAIT (0), the function will not wait.

The return value is true if an entry was successfully retrieved.

◆ as_queue_mt_pop_tail()

AS_EXTERN bool as_queue_mt_pop_tail ( as_queue_mt * queue,
void * ptr,
int wait_ms )

Pop from the tail of the queue.

If the queue is empty, wait_ms is the maximum time in milliseconds to wait for an available entry. If wait_ms is AS_QUEUE_FOREVER (-1), the wait time will be forever. If wait_ms is AS_QUEUE_NOWAIT (0), the function will not wait.

The return value is true if an entry was successfully retrieved.

◆ as_queue_mt_push()

static bool as_queue_mt_push ( as_queue_mt * queue,
const void * ptr )
inlinestatic

Push to the tail of the queue.

Definition at line 124 of file as_queue_mt.h.

References as_queue_push(), as_queue_mt::cond, as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_push_head()

static bool as_queue_mt_push_head ( as_queue_mt * queue,
const void * ptr )
inlinestatic

Push to the front of the queue.

Definition at line 156 of file as_queue_mt.h.

References as_queue_push_head(), as_queue_mt::cond, as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_push_head_limit()

static bool as_queue_mt_push_head_limit ( as_queue_mt * queue,
const void * ptr )
inlinestatic

Push to the front of the queue only if size < capacity.

Definition at line 172 of file as_queue_mt.h.

References as_queue_push_head_limit(), as_queue_mt::cond, as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_push_limit()

static bool as_queue_mt_push_limit ( as_queue_mt * queue,
const void * ptr )
inlinestatic

Push element on the queue only if size < capacity.

Definition at line 140 of file as_queue_mt.h.

References as_queue_push_limit(), as_queue_mt::cond, as_queue_mt::lock, and as_queue_mt::queue.

◆ as_queue_mt_size()

static uint32_t as_queue_mt_size ( as_queue_mt * queue)
inlinestatic

Get the number of elements currently in the queue.

Definition at line 100 of file as_queue_mt.h.

References as_queue_size(), as_queue_mt::lock, and as_queue_mt::queue.