Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
queue.c File Reference
#include "queue.h"
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "utils/arax_assert.h"
#include <limits.h>
+ Include dependency graph for queue.c:

Go to the source code of this file.

Macros

#define COMPILER_BARRIER()
 The Dynamic circular work-stealing deque WITHOUT the dynamic part ;) (https://dl.acm.org/citation.cfm?id=1073974)
 
#define UNLIKELY(cond)
 
#define LIKELY(cond)
 
#define utils_spinlock_init(V)
 
#define utils_spinlock_lock(V)
 
#define utils_spinlock_unlock(V)
 

Functions

utils_queue_sutils_queue_init (void *buff)
 
unsigned int utils_queue_used_slots (utils_queue_s *q)
 
void * utils_queue_pop (utils_queue_s *q)
 
void * utils_queue_push (utils_queue_s *q, void *data)
 
void * utils_queue_peek (utils_queue_s *q)
 

Macro Definition Documentation

◆ COMPILER_BARRIER

#define COMPILER_BARRIER ( )
Value:
asm volatile ("" : : : "memory")

The Dynamic circular work-stealing deque WITHOUT the dynamic part ;) (https://dl.acm.org/citation.cfm?id=1073974)

NOTE: Also WITHOUT pop-front

Removes the need for dynamic reallocation and constantly increasing bottom and top

Author
Foivos Zakkak zakka.nosp@m.k@ic.nosp@m.s.for.nosp@m.th.g.nosp@m.r

Definition at line 22 of file queue.c.

◆ LIKELY

#define LIKELY ( cond)
Value:
(cond)

Definition at line 29 of file queue.c.

◆ UNLIKELY

#define UNLIKELY ( cond)
Value:
(cond)

Definition at line 28 of file queue.c.

◆ utils_spinlock_init

◆ utils_spinlock_lock

◆ utils_spinlock_unlock

Function Documentation

◆ utils_queue_init()

utils_queue_s * utils_queue_init ( void * buff)

Initialize a queue at the memory pointed by buff.

Parameters
buffAllocated buffer.
Returns
queue instance.NULL on failure.

Definition at line 39 of file queue.c.

References arax_assert, and utils_spinlock_init.

Referenced by arax_vaccel_init().

+ Here is the caller graph for this function:

◆ utils_queue_peek()

void * utils_queue_peek ( utils_queue_s * q)

Peek first element from queue if any

Parameters
qValid queue instance pointer.
Returns
Data pointer, NULL on failure.

Definition at line 126 of file queue.c.

References queue::entries.

◆ utils_queue_pop()

void * utils_queue_pop ( utils_queue_s * q)

Pop data from queue.

Parameters
qValid queue instance pointer.
Returns
Data pointer, NULL on failure.

Definition at line 63 of file queue.c.

References arax_assert, and queue::entries.

◆ utils_queue_push()

void * utils_queue_push ( utils_queue_s * q,
void * data )

Add data to an queue

Parameters
qValid queue instance pointer.
dataNon NULL pointer to data.
Returns
Equal to data, NULL on failure.

Definition at line 89 of file queue.c.

References arax_assert, queue::entries, utils_spinlock_lock, and utils_spinlock_unlock.

Referenced by arax_vaccel_add_task().

+ Here is the caller graph for this function:

◆ utils_queue_used_slots()

unsigned int utils_queue_used_slots ( utils_queue_s * q)

Return number of used slots in the queue.

NOTE: Since this is a concurrent queue the value returned by this function may not always reflect the true state of the queue

Parameters
qValid queue instance pointer.
Returns
Number of used slots in queue.

Definition at line 51 of file queue.c.

Referenced by arax_vaccel_queue_size().

+ Here is the caller graph for this function: