The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Typedefs | Functions
atomic_queue.h File Reference

Thread-safe queues. More...

#include <stdbool.h>
#include <freeradius-devel/util/stdatomic.h>
#include <freeradius-devel/util/talloc.h>
+ Include dependency graph for atomic_queue.h:

Go to the source code of this file.

Typedefs

typedef struct fr_atomic_queue_s fr_atomic_queue_t
 

Functions

fr_atomic_queue_tfr_atomic_queue_alloc (TALLOC_CTX *ctx, size_t size)
 Create fixed-size atomic queue.
 
void fr_atomic_queue_debug (FILE *fp, fr_atomic_queue_t *aq)
 Dump an atomic queue.
 
void fr_atomic_queue_free (fr_atomic_queue_t **aq)
 Free an atomic queue if it's not freed by ctx.
 
bool fr_atomic_queue_pop (fr_atomic_queue_t *aq, void **p_data)
 Pop a pointer from the atomic queue.
 
bool fr_atomic_queue_push (fr_atomic_queue_t *aq, void *data)
 Push a pointer into the atomic queue.
 
size_t fr_atomic_queue_size (fr_atomic_queue_t *aq)
 

Detailed Description

Thread-safe queues.

Id
82266f72d8f657073a7733a11f127f4fa5ff4d95

Definition in file atomic_queue.h.

Typedef Documentation

◆ fr_atomic_queue_t

Definition at line 41 of file atomic_queue.h.

Function Documentation

◆ fr_atomic_queue_alloc()

fr_atomic_queue_t * fr_atomic_queue_alloc ( TALLOC_CTX *  ctx,
size_t  size 
)

Create fixed-size atomic queue.

Note
the queue must be freed explicitly by the ctx being freed, or by using the fr_atomic_queue_free function.
Parameters
[in]ctxThe talloc ctx to allocate the queue in.
[in]sizeThe number of entries in the queue.
Returns
  • NULL on error.
  • fr_atomic_queue_t *, a pointer to the allocated and initialized queue.

Definition at line 114 of file atomic_queue.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_atomic_queue_debug()

void fr_atomic_queue_debug ( FILE *  fp,
fr_atomic_queue_t aq 
)

Dump an atomic queue.

Absolutely NOT thread-safe.

Parameters
[in]aqThe atomic queue to debug.
[in]fpwhere the debugging information will be printed.

Definition at line 408 of file atomic_queue.c.

+ Here is the caller graph for this function:

◆ fr_atomic_queue_free()

void fr_atomic_queue_free ( fr_atomic_queue_t **  aq)

Free an atomic queue if it's not freed by ctx.

This function is needed because the atomic queue memory must be cache line aligned.

Definition at line 171 of file atomic_queue.c.

+ Here is the call graph for this function:

◆ fr_atomic_queue_pop()

bool fr_atomic_queue_pop ( fr_atomic_queue_t aq,
void **  p_data 
)

Pop a pointer from the atomic queue.

Parameters
[in]aqthe atomic queue to retrieve data from.
[out]p_datawhere to write the data.
Returns
  • true on successful pop
  • false on queue empty

Definition at line 310 of file atomic_queue.c.

+ Here is the caller graph for this function:

◆ fr_atomic_queue_push()

bool fr_atomic_queue_push ( fr_atomic_queue_t aq,
void *  data 
)

Push a pointer into the atomic queue.

Parameters
[in]aqThe atomic queue to add data to.
[in]datato push.
Returns
  • true on successful push
  • false on queue full

Definition at line 187 of file atomic_queue.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_atomic_queue_size()

size_t fr_atomic_queue_size ( fr_atomic_queue_t aq)

Definition at line 372 of file atomic_queue.c.

+ Here is the caller graph for this function: