![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
#include "queue.h"
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "utils/arax_assert.h"
#include <limits.h>
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_s * | utils_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) |
#define COMPILER_BARRIER | ( | ) |
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
#define utils_spinlock_init | ( | V | ) |
Definition at line 34 of file queue.c.
Referenced by arax_object_repo_init(), arax_throttle_init(), arax_vaccel_init(), arch_alloc_init_once(), async_meta_init_once(), async_semaphore_init(), utils_bitmap_init(), utils_kv_init(), and utils_queue_init().
#define utils_spinlock_lock | ( | V | ) |
Definition at line 35 of file queue.c.
Referenced by _add_completion(), _arch_alloc_free(), arax_accel_add_vaccel(), arax_accel_del_vaccel(), arax_object_list_lock(), arax_object_ref_dec(), arax_object_register(), arax_pipe_have_to_mmap(), arax_pipe_mark_unmap(), arax_vaccel_add_task(), arch_alloc_allocate(), async_semaphore_dec(), async_semaphore_inc(), utils_bitmap_alloc_bits(), utils_bitmap_free_bits(), utils_kv_get(), utils_kv_set(), and utils_queue_push().
#define utils_spinlock_unlock | ( | V | ) |
Definition at line 36 of file queue.c.
Referenced by _add_completion(), _arch_alloc_free(), arax_accel_add_vaccel(), arax_accel_del_vaccel(), arax_object_list_unlock(), arax_object_ref_dec(), arax_object_register(), arax_pipe_have_to_mmap(), arax_pipe_mark_unmap(), arax_vaccel_add_task(), arch_alloc_allocate(), async_semaphore_dec(), async_semaphore_inc(), utils_bitmap_alloc_bits(), utils_bitmap_free_bits(), utils_kv_get(), utils_kv_set(), and utils_queue_push().
utils_queue_s * utils_queue_init | ( | void * | buff | ) |
Initialize a queue at the memory pointed by buff.
buff | Allocated buffer. |
Definition at line 39 of file queue.c.
References arax_assert, and utils_spinlock_init.
Referenced by arax_vaccel_init().
void * utils_queue_peek | ( | utils_queue_s * | q | ) |
Peek first element from queue if any
q | Valid queue instance pointer. |
Definition at line 126 of file queue.c.
References queue::entries.
void * utils_queue_pop | ( | utils_queue_s * | q | ) |
Pop data from queue.
q | Valid queue instance pointer. |
Definition at line 63 of file queue.c.
References arax_assert, and queue::entries.
void * utils_queue_push | ( | utils_queue_s * | q, |
void * | data ) |
Add data to an queue
q | Valid queue instance pointer. |
data | Non NULL pointer to data. |
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().
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
q | Valid queue instance pointer. |
Definition at line 51 of file queue.c.
Referenced by arax_vaccel_queue_size().