urcu/arch/sparc64.h \
urcu/arch/tile.h \
urcu/arch/x86.h \
+ urcu/assert.h \
urcu/call-rcu.h \
urcu/cds.h \
urcu/compiler.h \
--- /dev/null
+#ifndef _URCU_ASSERT_H
+#define _URCU_ASSERT_H
+
+/*
+ * urcu/assert.h
+ *
+ * Userspace RCU assertion facilities.
+ *
+ * Copyright (c) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ */
+
+#include <urcu/config.h>
+
+/*
+ * Force usage of an expression to prevent unused expression compiler warning.
+ */
+#define _urcu_use_expression(_expr) ((void) sizeof((void) (_expr), 0))
+
+#ifdef NDEBUG
+/*
+ * Vanilla assert() replacement. When NDEBUG is defined, the expression is
+ * consumed to prevent unused variable compile warnings.
+ */
+# define urcu_posix_assert(_cond) _urcu_use_expression(_cond)
+#else
+# include <assert.h>
+# define urcu_posix_assert(_cond) assert(_cond)
+#endif
+
+#if defined(DEBUG_RCU) || defined(CONFIG_RCU_DEBUG)
+
+/*
+ * Enables debugging/expensive assertions to be used in fast paths and only
+ * enabled on demand. When disabled, the expression is consumed to prevent
+ * unused variable compile warnings.
+ */
+# define urcu_assert_debug(_cond) urcu_posix_assert(_cond)
+#else
+# define urcu_assert_debug(_cond) _urcu_use_expression(_cond)
+#endif
+
+#endif /* _URCU_ASSERT_H */
* all copies or substantial portions of the Software.
*/
-#include <assert.h>
-
-#include <urcu/config.h>
-
-#if defined(DEBUG_RCU) || defined(CONFIG_RCU_DEBUG)
-# define urcu_assert_debug(...) assert(__VA_ARGS__)
-#else
-# define urcu_assert_debug(...)
-#endif
+#include <urcu/assert.h>
/*
* For backward compatibility reasons, this file must expose the urcu_assert()
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <assert.h>
#ifdef __cplusplus
extern "C" {
* published by the Free Software Foundation.
*/
-#include <assert.h>
#include <stdbool.h>
#include <limits.h>
#include <stdlib.h>
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
struct urcu_ref {
void (*release)(struct urcu_ref *))
{
long res = uatomic_sub_return(&ref->refcount, 1);
- assert (res >= 0);
+ urcu_posix_assert(res >= 0);
if (res == 0)
release(ref);
}
#include <stdbool.h>
#include <pthread.h>
-#include <assert.h>
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
#include <urcu-pointer.h>
s->head = NULL;
ret = pthread_mutex_init(&s->lock, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
void _cds_lfs_destroy(struct cds_lfs_stack *s)
{
int ret = pthread_mutex_destroy(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
int ret;
ret = pthread_mutex_lock(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
int ret;
ret = pthread_mutex_unlock(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
*/
#include <urcu-call-rcu.h>
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
#include <urcu-pointer.h>
-#include <assert.h>
#include <errno.h>
#ifdef __cplusplus
struct cds_lfq_node_rcu_dummy *dummy;
dummy = malloc(sizeof(struct cds_lfq_node_rcu_dummy));
- assert(dummy);
+ urcu_posix_assert(dummy);
dummy->parent.next = next;
dummy->parent.dummy = 1;
dummy->q = q;
{
struct cds_lfq_node_rcu_dummy *dummy;
- assert(node->dummy);
+ urcu_posix_assert(node->dummy);
dummy = caa_container_of(node, struct cds_lfq_node_rcu_dummy, parent);
dummy->q->queue_call_rcu(&dummy->head, free_dummy_cb);
}
{
struct cds_lfq_node_rcu_dummy *dummy;
- assert(node->dummy);
+ urcu_posix_assert(node->dummy);
dummy = caa_container_of(node, struct cds_lfq_node_rcu_dummy, parent);
free(dummy);
}
#include <pthread.h>
#include <unistd.h>
+#include <urcu/debug.h>
#include <urcu/config.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/uatomic.h>
#include <urcu/list.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
/*
* This code section can only be included in LGPL 2.1 compatible source code.
#include <urcu/list.h>
#include <urcu/futex.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
#ifdef __cplusplus
extern "C" {
#include <unistd.h>
#include <stdint.h>
+#include <urcu/debug.h>
#include <urcu/config.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/list.h>
#include <urcu/futex.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
#include <urcu/static/urcu-common.h>
#ifdef __cplusplus
#include <unistd.h>
#include <stdint.h>
+#include <urcu/debug.h>
#include <urcu/config.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/list.h>
#include <urcu/futex.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
#include <urcu/static/urcu-common.h>
#ifdef __cplusplus
#include <unistd.h>
#include <stdint.h>
+#include <urcu/debug.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/system.h>
#include <urcu/list.h>
#include <urcu/futex.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
#include <urcu/static/urcu-common.h>
#ifdef __cplusplus
#include <unistd.h>
#include <stdint.h>
+#include <urcu/debug.h>
#include <urcu/config.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/list.h>
#include <urcu/futex.h>
#include <urcu/tls-compat.h>
-#include <urcu/debug.h>
#include <urcu/static/urcu-common.h>
#include <urcu/static/urcu-signal-nr.h>
*/
#include <pthread.h>
-#include <assert.h>
#include <poll.h>
#include <stdbool.h>
+#include <urcu/assert.h>
#include <urcu/compiler.h>
#include <urcu/uatomic.h>
_cds_wfcq_node_init(&head->node);
tail->p = &head->node;
ret = pthread_mutex_init(&head->lock, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
struct cds_wfcq_tail *tail __attribute__((unused)))
{
int ret = pthread_mutex_destroy(&head->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
int ret;
ret = pthread_mutex_lock(&head->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static inline void _cds_wfcq_dequeue_unlock(struct cds_wfcq_head *head,
int ret;
ret = pthread_mutex_unlock(&head->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static inline bool ___cds_wfcq_append(cds_wfcq_head_ptr_t u_head,
*/
#include <pthread.h>
-#include <assert.h>
#include <poll.h>
+#include <urcu/assert.h>
#include <urcu/compiler.h>
#include <urcu/uatomic.h>
q->head = &q->dummy;
q->tail = &q->dummy.next;
ret = pthread_mutex_init(&q->lock, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static inline void _cds_wfq_destroy(struct cds_wfq_queue *q)
{
int ret = pthread_mutex_destroy(&q->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static inline void _cds_wfq_enqueue(struct cds_wfq_queue *q,
int ret;
ret = pthread_mutex_lock(&q->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
retnode = ___cds_wfq_dequeue_blocking(q);
ret = pthread_mutex_unlock(&q->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
return retnode;
}
*/
#include <pthread.h>
-#include <assert.h>
#include <poll.h>
#include <stdbool.h>
+#include <urcu/assert.h>
#include <urcu/compiler.h>
#include <urcu/uatomic.h>
s->head = CDS_WFS_END;
ret = pthread_mutex_init(&s->lock, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
void _cds_wfs_destroy(struct cds_wfs_stack *s)
{
int ret = pthread_mutex_destroy(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static inline bool ___cds_wfs_end(void *node)
struct __cds_wfs_stack *s = u_stack._s;
struct cds_wfs_head *old_head, *new_head;
- assert(node->next == NULL);
+ urcu_posix_assert(node->next == NULL);
new_head = caa_container_of(node, struct cds_wfs_head, node);
/*
* uatomic_xchg() implicit memory barrier orders earlier stores
int ret;
ret = pthread_mutex_lock(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
int ret;
ret = pthread_mutex_unlock(&s->lock);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
*/
#include <pthread.h>
-#include <assert.h>
#include <stdbool.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
*/
#include <pthread.h>
-#include <assert.h>
#include <urcu/compiler.h>
#ifdef __cplusplus
*/
#include <pthread.h>
-#include <assert.h>
#include <stdbool.h>
#include <urcu/compiler.h>
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
/*
/* Disable signals */
ret = sigfillset(&newmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
ret = pthread_sigmask(SIG_BLOCK, &newmask, oldmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
ret = pthread_mutex_lock(&__urcu_x86_compat_mutex);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static void mutex_lock_signal_restore(pthread_mutex_t *mutex, sigset_t *oldmask)
int ret;
ret = pthread_mutex_unlock(&__urcu_x86_compat_mutex);
- assert(!ret);
+ urcu_posix_assert(!ret);
ret = pthread_sigmask(SIG_SETMASK, oldmask, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
unsigned long _compat_uatomic_set(void *addr, unsigned long _new, int len)
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <errno.h>
#include <poll.h>
#include <stdint.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/futex.h>
#include <urcu/system.h>
* Check if NULL. Don't let users expect that they are taken into
* account.
*/
- assert(!timeout);
- assert(!uaddr2);
- assert(!val3);
+ urcu_posix_assert(!timeout);
+ urcu_posix_assert(!uaddr2);
+ urcu_posix_assert(!val3);
/*
* memory barriers to serialize with the previous uaddr modification.
* Check if NULL. Don't let users expect that they are taken into
* account.
*/
- assert(!timeout);
- assert(!uaddr2);
- assert(!val3);
+ urcu_posix_assert(!timeout);
+ urcu_posix_assert(!uaddr2);
+ urcu_posix_assert(!val3);
/*
* Ensure previous memory operations on uaddr have completed.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <urcu/assert.h>
#include <urcu/rculfhash.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
#ifdef DEBUG
#define dbg_printf(fmt, args...) printf("[debug rculfhash] " fmt, ## args)
struct cds_lfht *ht;
ht = calloc(1, cds_lfht_size);
- assert(ht);
+ urcu_posix_assert(ht);
ht->mm = mm;
ht->bucket_at = mm->bucket_at;
*/
#include <stddef.h>
+#include <urcu/assert.h>
#include <rculfhash-internal.h>
static
if (order == 0) {
ht->tbl_chunk[0] = calloc(ht->min_nr_alloc_buckets,
sizeof(struct cds_lfht_node));
- assert(ht->tbl_chunk[0]);
+ urcu_posix_assert(ht->tbl_chunk[0]);
} else if (order > ht->min_alloc_buckets_order) {
unsigned long i, len = 1UL << (order - 1 - ht->min_alloc_buckets_order);
for (i = len; i < 2 * len; i++) {
ht->tbl_chunk[i] = calloc(ht->min_nr_alloc_buckets,
sizeof(struct cds_lfht_node));
- assert(ht->tbl_chunk[i]);
+ urcu_posix_assert(ht->tbl_chunk[i]);
}
}
/* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
#include <errno.h>
#include <stdlib.h>
#include <sys/mman.h>
+#include <urcu/assert.h>
#include "rculfhash-internal.h"
#ifndef MAP_ANONYMOUS
/* small table */
ht->tbl_mmap = calloc(ht->max_nr_buckets,
sizeof(*ht->tbl_mmap));
- assert(ht->tbl_mmap);
+ urcu_posix_assert(ht->tbl_mmap);
return;
}
/* large table */
/* large table */
unsigned long len = 1UL << (order - 1);
- assert(ht->min_nr_alloc_buckets < ht->max_nr_buckets);
+ urcu_posix_assert(ht->min_nr_alloc_buckets < ht->max_nr_buckets);
memory_populate(ht->tbl_mmap + len,
len * sizeof(*ht->tbl_mmap));
}
/* large table */
unsigned long len = 1UL << (order - 1);
- assert(ht->min_nr_alloc_buckets < ht->max_nr_buckets);
+ urcu_posix_assert(ht->min_nr_alloc_buckets < ht->max_nr_buckets);
memory_discard(ht->tbl_mmap + len, len * sizeof(*ht->tbl_mmap));
}
/* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <urcu/assert.h>
#include <rculfhash-internal.h>
static
if (order == 0) {
ht->tbl_order[0] = calloc(ht->min_nr_alloc_buckets,
sizeof(struct cds_lfht_node));
- assert(ht->tbl_order[0]);
+ urcu_posix_assert(ht->tbl_order[0]);
} else if (order > ht->min_alloc_buckets_order) {
ht->tbl_order[order] = calloc(1UL << (order -1),
sizeof(struct cds_lfht_node));
- assert(ht->tbl_order[order]);
+ urcu_posix_assert(ht->tbl_order[order]);
}
/* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */
}
#define _LGPL_SOURCE
#include <stdlib.h>
#include <errno.h>
-#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include "compat-getcpu.h"
+#include <urcu/assert.h>
#include <urcu/pointer.h>
#include <urcu/call-rcu.h>
#include <urcu/flavor.h>
iter->lfht = ht;
}
-#define cds_lfht_iter_debug_assert(...) assert(__VA_ARGS__)
+#define cds_lfht_iter_debug_assert(...) urcu_posix_assert(__VA_ARGS__)
#else
cds_lfht_get_count_order_ulong(split_count_mask + 1);
}
- assert(split_count_mask >= 0);
+ urcu_posix_assert(split_count_mask >= 0);
if (ht->flags & CDS_LFHT_ACCOUNTING) {
ht->split_count = calloc(split_count_mask + 1,
sizeof(struct ht_items_count));
- assert(ht->split_count);
+ urcu_posix_assert(ht->split_count);
} else {
ht->split_count = NULL;
}
{
int cpu;
- assert(split_count_mask >= 0);
+ urcu_posix_assert(split_count_mask >= 0);
cpu = urcu_sched_getcpu();
if (caa_unlikely(cpu < 0))
return hash & split_count_mask;
struct cds_lfht_node *lookup_bucket(struct cds_lfht *ht, unsigned long size,
unsigned long hash)
{
- assert(size > 0);
+ urcu_posix_assert(size > 0);
return bucket_at(ht, hash & (size - 1));
}
{
struct cds_lfht_node *iter_prev, *iter, *next, *new_next;
- assert(!is_bucket(bucket));
- assert(!is_removed(bucket));
- assert(!is_removal_owner(bucket));
- assert(!is_bucket(node));
- assert(!is_removed(node));
- assert(!is_removal_owner(node));
+ urcu_posix_assert(!is_bucket(bucket));
+ urcu_posix_assert(!is_removed(bucket));
+ urcu_posix_assert(!is_removal_owner(bucket));
+ urcu_posix_assert(!is_bucket(node));
+ urcu_posix_assert(!is_removed(node));
+ urcu_posix_assert(!is_removal_owner(node));
for (;;) {
iter_prev = bucket;
/* We can always skip the bucket node initially */
iter = rcu_dereference(iter_prev->next);
- assert(!is_removed(iter));
- assert(!is_removal_owner(iter));
- assert(iter_prev->reverse_hash <= node->reverse_hash);
+ urcu_posix_assert(!is_removed(iter));
+ urcu_posix_assert(!is_removal_owner(iter));
+ urcu_posix_assert(iter_prev->reverse_hash <= node->reverse_hash);
/*
* We should never be called with bucket (start of chain)
* and logically removed node (end of path compression
* marker) being the actual same node. This would be a
* bug in the algorithm implementation.
*/
- assert(bucket != node);
+ urcu_posix_assert(bucket != node);
for (;;) {
if (caa_unlikely(is_end(iter)))
return;
iter_prev = clear_flag(iter);
iter = next;
}
- assert(!is_removed(iter));
- assert(!is_removal_owner(iter));
+ urcu_posix_assert(!is_removed(iter));
+ urcu_posix_assert(!is_removal_owner(iter));
if (is_bucket(iter))
new_next = flag_bucket(clear_flag(next));
else
if (!old_node) /* Return -ENOENT if asked to replace NULL node */
return -ENOENT;
- assert(!is_removed(old_node));
- assert(!is_removal_owner(old_node));
- assert(!is_bucket(old_node));
- assert(!is_removed(new_node));
- assert(!is_removal_owner(new_node));
- assert(!is_bucket(new_node));
- assert(new_node != old_node);
+ urcu_posix_assert(!is_removed(old_node));
+ urcu_posix_assert(!is_removal_owner(old_node));
+ urcu_posix_assert(!is_bucket(old_node));
+ urcu_posix_assert(!is_removed(new_node));
+ urcu_posix_assert(!is_removal_owner(new_node));
+ urcu_posix_assert(!is_bucket(new_node));
+ urcu_posix_assert(new_node != old_node);
for (;;) {
/* Insert after node to be replaced */
if (is_removed(old_next)) {
*/
return -ENOENT;
}
- assert(old_next == clear_flag(old_next));
- assert(new_node != old_next);
+ urcu_posix_assert(old_next == clear_flag(old_next));
+ urcu_posix_assert(new_node != old_next);
/*
* REMOVAL_OWNER flag is _NEVER_ set before the REMOVED
* flag. It is either set atomically at the same time
* (replace) or after (del).
*/
- assert(!is_removal_owner(old_next));
+ urcu_posix_assert(!is_removal_owner(old_next));
new_node->next = old_next;
/*
* Here is the whole trick for lock-free replace: we add
bucket = lookup_bucket(ht, size, bit_reverse_ulong(old_node->reverse_hash));
_cds_lfht_gc_bucket(bucket, new_node);
- assert(is_removed(CMM_LOAD_SHARED(old_node->next)));
+ urcu_posix_assert(is_removed(CMM_LOAD_SHARED(old_node->next)));
return 0;
}
*return_node;
struct cds_lfht_node *bucket;
- assert(!is_bucket(node));
- assert(!is_removed(node));
- assert(!is_removal_owner(node));
+ urcu_posix_assert(!is_bucket(node));
+ urcu_posix_assert(!is_removed(node));
+ urcu_posix_assert(!is_removal_owner(node));
bucket = lookup_bucket(ht, size, hash);
for (;;) {
uint32_t chain_len = 0;
iter_prev = bucket;
/* We can always skip the bucket node initially */
iter = rcu_dereference(iter_prev->next);
- assert(iter_prev->reverse_hash <= node->reverse_hash);
+ urcu_posix_assert(iter_prev->reverse_hash <= node->reverse_hash);
for (;;) {
if (caa_unlikely(is_end(iter)))
goto insert;
}
insert:
- assert(node != clear_flag(iter));
- assert(!is_removed(iter_prev));
- assert(!is_removal_owner(iter_prev));
- assert(!is_removed(iter));
- assert(!is_removal_owner(iter));
- assert(iter_prev != node);
+ urcu_posix_assert(node != clear_flag(iter));
+ urcu_posix_assert(!is_removed(iter_prev));
+ urcu_posix_assert(!is_removal_owner(iter_prev));
+ urcu_posix_assert(!is_removed(iter));
+ urcu_posix_assert(!is_removal_owner(iter));
+ urcu_posix_assert(iter_prev != node);
if (!bucket_flag)
node->next = clear_flag(iter);
else
}
gc_node:
- assert(!is_removed(iter));
- assert(!is_removal_owner(iter));
+ urcu_posix_assert(!is_removed(iter));
+ urcu_posix_assert(!is_removal_owner(iter));
if (is_bucket(iter))
new_next = flag_bucket(clear_flag(next));
else
return -ENOENT;
/* logically delete the node */
- assert(!is_bucket(node));
- assert(!is_removed(node));
- assert(!is_removal_owner(node));
+ urcu_posix_assert(!is_bucket(node));
+ urcu_posix_assert(!is_removed(node));
+ urcu_posix_assert(!is_removal_owner(node));
/*
* We are first checking if the node had previously been
next = CMM_LOAD_SHARED(node->next); /* next is not dereferenced */
if (caa_unlikely(is_removed(next)))
return -ENOENT;
- assert(!is_bucket(next));
+ urcu_posix_assert(!is_bucket(next));
/*
* The del operation semantic guarantees a full memory barrier
* before the uatomic_or atomic commit of the deletion flag.
bucket = lookup_bucket(ht, size, bit_reverse_ulong(node->reverse_hash));
_cds_lfht_gc_bucket(bucket, node);
- assert(is_removed(CMM_LOAD_SHARED(node->next)));
+ urcu_posix_assert(is_removed(CMM_LOAD_SHARED(node->next)));
/*
* Last phase: atomically exchange node->next with a version
* having "REMOVAL_OWNER_FLAG" set. If the returned node->next
int ret;
unsigned long thread, nr_threads;
- assert(nr_cpus_mask != -1);
+ urcu_posix_assert(nr_cpus_mask != -1);
if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
goto fallback;
nr_threads = thread;
break;
}
- assert(!ret);
+ urcu_posix_assert(!ret);
}
for (thread = 0; thread < nr_threads; thread++) {
ret = pthread_join(work[thread].thread_id, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
free(work);
{
unsigned long j, size = 1UL << (i - 1);
- assert(i > MIN_TABLE_ORDER);
+ urcu_posix_assert(i > MIN_TABLE_ORDER);
ht->flavor->read_lock();
for (j = size + start; j < size + start + len; j++) {
struct cds_lfht_node *new_node = bucket_at(ht, j);
- assert(j >= size && j < (size << 1));
+ urcu_posix_assert(j >= size && j < (size << 1));
dbg_printf("init populate: order %lu index %lu hash %lu\n",
i, j, j);
new_node->reverse_hash = bit_reverse_ulong(j);
dbg_printf("init table: first_order %lu last_order %lu\n",
first_order, last_order);
- assert(first_order > MIN_TABLE_ORDER);
+ urcu_posix_assert(first_order > MIN_TABLE_ORDER);
for (i = first_order; i <= last_order; i++) {
unsigned long len;
{
unsigned long j, size = 1UL << (i - 1);
- assert(i > MIN_TABLE_ORDER);
+ urcu_posix_assert(i > MIN_TABLE_ORDER);
ht->flavor->read_lock();
for (j = size + start; j < size + start + len; j++) {
struct cds_lfht_node *fini_bucket = bucket_at(ht, j);
struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size);
- assert(j >= size && j < (size << 1));
+ urcu_posix_assert(j >= size && j < (size << 1));
dbg_printf("remove entry: order %lu index %lu hash %lu\n",
i, j, j);
/* Set the REMOVED_FLAG to freeze the ->next for gc */
dbg_printf("fini table: first_order %lu last_order %lu\n",
first_order, last_order);
- assert(first_order > MIN_TABLE_ORDER);
+ urcu_posix_assert(first_order > MIN_TABLE_ORDER);
for (i = last_order; i >= first_order; i--) {
unsigned long len;
node->reverse_hash = 0;
bucket_order = cds_lfht_get_count_order_ulong(size);
- assert(bucket_order >= 0);
+ urcu_posix_assert(bucket_order >= 0);
for (order = 1; order < (unsigned long) bucket_order + 1; order++) {
len = 1UL << (order - 1);
node->reverse_hash = bit_reverse_ulong(len + i);
/* insert after prev */
- assert(is_bucket(prev->next));
+ urcu_posix_assert(is_bucket(prev->next));
node->next = prev->next;
prev->next = flag_bucket(node);
}
init_size = min(init_size, max_nr_buckets);
ht = mm->alloc_cds_lfht(min_nr_alloc_buckets, max_nr_buckets);
- assert(ht);
- assert(ht->mm == mm);
- assert(ht->bucket_at == mm->bucket_at);
+ urcu_posix_assert(ht);
+ urcu_posix_assert(ht->mm == mm);
+ urcu_posix_assert(ht->bucket_at == mm->bucket_at);
ht->flags = flags;
ht->flavor = flavor;
break;
}
next = rcu_dereference(node->next);
- assert(node == clear_flag(node));
+ urcu_posix_assert(node == clear_flag(node));
if (caa_likely(!is_removed(next))
&& !is_bucket(next)
&& node->reverse_hash == reverse_hash
}
node = clear_flag(next);
}
- assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
+ urcu_posix_assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
iter->node = node;
iter->next = next;
}
}
node = clear_flag(next);
}
- assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
+ urcu_posix_assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
iter->node = node;
iter->next = next;
}
}
node = clear_flag(next);
}
- assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
+ urcu_posix_assert(!node || !is_bucket(CMM_LOAD_SHARED(node->next)));
iter->node = node;
iter->next = next;
}
node = clear_flag(node)->next;
if (!is_bucket(node))
return -EPERM;
- assert(!is_removed(node));
- assert(!is_removal_owner(node));
+ urcu_posix_assert(!is_removed(node));
+ urcu_posix_assert(!is_removal_owner(node));
} while (!is_end(node));
/*
* size accessed without rcu_dereference because hash table is
node = bucket_at(ht, i);
dbg_printf("delete bucket: index %lu expected hash %lu hash %lu\n",
i, i, bit_reverse_ulong(node->reverse_hash));
- assert(is_bucket(node->next));
+ urcu_posix_assert(is_bucket(node->next));
}
for (order = cds_lfht_get_count_order_ulong(size); (long)order >= 0; order--)
new_order = cds_lfht_get_count_order_ulong(new_size);
dbg_printf("resize from %lu (order %lu) to %lu (order %lu) buckets\n",
old_size, old_order, new_size, new_order);
- assert(new_size > old_size);
+ urcu_posix_assert(new_size > old_size);
init_table(ht, old_order + 1, new_order);
}
new_order = cds_lfht_get_count_order_ulong(new_size);
dbg_printf("resize from %lu (order %lu) to %lu (order %lu) buckets\n",
old_size, old_order, new_size, new_order);
- assert(new_size < old_size);
+ urcu_posix_assert(new_size < old_size);
/* Remove and unlink all bucket nodes to remove. */
fini_table(ht, new_order + 1, old_order);
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <sys/mman.h>
+#include <urcu/assert.h>
#include <urcu/config.h>
#include <urcu/arch.h>
#include <urcu/wfcqueue.h>
size_t new_size __attribute__((unused)),
int flags)
{
- assert(!(flags & MREMAP_MAYMOVE));
+ urcu_posix_assert(!(flags & MREMAP_MAYMOVE));
return MAP_FAILED;
}
int ret;
ret = sigfillset(&newmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
ret = pthread_sigmask(SIG_BLOCK, &newmask, &oldmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
mutex_lock(&rcu_gp_lock);
mutex_unlock(&rcu_registry_lock);
mutex_unlock(&rcu_gp_lock);
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
/* No chunk. */
if (cds_list_empty(&arena->chunk_list)) {
- assert(ARENA_INIT_ALLOC >=
+ urcu_posix_assert(ARENA_INIT_ALLOC >=
sizeof(struct registry_chunk)
+ sizeof(struct rcu_reader));
new_chunk_len = ARENA_INIT_ALLOC;
new_chunk_len, 0);
if (new_chunk != MAP_FAILED) {
/* Should not have moved. */
- assert(new_chunk == last_chunk);
+ urcu_posix_assert(new_chunk == last_chunk);
memset((char *) last_chunk + old_chunk_len, 0,
new_chunk_len - old_chunk_len);
last_chunk->data_len =
/* Add to registry */
rcu_reader_reg->tid = pthread_self();
- assert(rcu_reader_reg->ctr == 0);
+ urcu_posix_assert(rcu_reader_reg->ctr == 0);
cds_list_add(&rcu_reader_reg->node, ®istry);
/*
* Reader threads are pointing to the reader registry. This is
int ret;
ret = sigfillset(&newmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
ret = pthread_sigmask(SIG_BLOCK, &newmask, &oldmask);
- assert(!ret);
+ urcu_posix_assert(!ret);
mutex_lock(&rcu_gp_lock);
mutex_lock(&rcu_registry_lock);
saved_fork_signal_mask = oldmask;
mutex_unlock(&rcu_registry_lock);
mutex_unlock(&rcu_gp_lock);
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
/*
mutex_unlock(&rcu_registry_lock);
mutex_unlock(&rcu_gp_lock);
ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
void *urcu_bp_dereference_sym(void *p)
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sched.h>
#include "compat-getcpu.h"
+#include <urcu/assert.h>
#include <urcu/wfcqueue.h>
#include <urcu/call-rcu.h>
#include <urcu/pointer.h>
cds_wfcq_init(&cbs_tmp_head, &cbs_tmp_tail);
splice_ret = __cds_wfcq_splice_blocking(&cbs_tmp_head,
&cbs_tmp_tail, &crdp->cbs_head, &crdp->cbs_tail);
- assert(splice_ret != CDS_WFCQ_RET_WOULDBLOCK);
- assert(splice_ret != CDS_WFCQ_RET_DEST_NON_EMPTY);
+ urcu_posix_assert(splice_ret != CDS_WFCQ_RET_WOULDBLOCK);
+ urcu_posix_assert(splice_ret != CDS_WFCQ_RET_DEST_NON_EMPTY);
if (splice_ret != CDS_WFCQ_RET_SRC_EMPTY) {
synchronize_rcu();
cbcount = 0;
#include <pthread.h>
#include <stdio.h>
#include <signal.h>
-#include <assert.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
#include "urcu/futex.h"
+#include <urcu/assert.h>
#include <urcu/compiler.h>
#include <urcu/arch.h>
#include <urcu/uatomic.h>
* Worse-case: must allow 2 supplementary entries for fct pointer.
*/
if (caa_unlikely(head - tail >= DEFER_QUEUE_SIZE - 2)) {
- assert(head - tail <= DEFER_QUEUE_SIZE);
+ urcu_posix_assert(head - tail <= DEFER_QUEUE_SIZE);
rcu_defer_barrier_thread();
- assert(head - CMM_LOAD_SHARED(URCU_TLS(defer_queue).tail) == 0);
+ urcu_posix_assert(head - CMM_LOAD_SHARED(URCU_TLS(defer_queue).tail) == 0);
}
/*
int ret;
ret = pthread_create(&tid_defer, NULL, thr_defer, NULL);
- assert(!ret);
+ urcu_posix_assert(!ret);
}
static void stop_defer_thread(void)
wake_up_defer();
ret = pthread_join(tid_defer, &tret);
- assert(!ret);
+ urcu_posix_assert(!ret);
CMM_STORE_SHARED(defer_thread_stop, 0);
/* defer thread should always exit when futex value is 0 */
- assert(uatomic_read(&defer_thread_futex) == 0);
+ urcu_posix_assert(uatomic_read(&defer_thread_futex) == 0);
}
int rcu_defer_register_thread(void)
{
int was_empty;
- assert(URCU_TLS(defer_queue).last_head == 0);
- assert(URCU_TLS(defer_queue).q == NULL);
+ urcu_posix_assert(URCU_TLS(defer_queue).last_head == 0);
+ urcu_posix_assert(URCU_TLS(defer_queue).q == NULL);
URCU_TLS(defer_queue).q = malloc(sizeof(void *) * DEFER_QUEUE_SIZE);
if (!URCU_TLS(defer_queue).q)
return -ENOMEM;
void rcu_defer_exit(void)
{
- assert(cds_list_empty(®istry_defer));
+ urcu_posix_assert(cds_list_empty(®istry_defer));
}
#endif /* _URCU_DEFER_IMPL_H */
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <poll.h>
+#include <urcu/assert.h>
#include <urcu/wfcqueue.h>
#include <urcu/map/urcu-qsbr.h>
#define BUILD_QSBR_LIB
void urcu_qsbr_register_thread(void)
{
URCU_TLS(urcu_qsbr_reader).tid = pthread_self();
- assert(URCU_TLS(urcu_qsbr_reader).ctr == 0);
+ urcu_posix_assert(URCU_TLS(urcu_qsbr_reader).ctr == 0);
mutex_lock(&rcu_registry_lock);
- assert(!URCU_TLS(urcu_qsbr_reader).registered);
+ urcu_posix_assert(!URCU_TLS(urcu_qsbr_reader).registered);
URCU_TLS(urcu_qsbr_reader).registered = 1;
cds_list_add(&URCU_TLS(urcu_qsbr_reader).node, ®istry);
mutex_unlock(&rcu_registry_lock);
* with a waiting writer.
*/
_urcu_qsbr_thread_offline();
- assert(URCU_TLS(urcu_qsbr_reader).registered);
+ urcu_posix_assert(URCU_TLS(urcu_qsbr_reader).registered);
URCU_TLS(urcu_qsbr_reader).registered = 0;
mutex_lock(&rcu_registry_lock);
cds_list_del(&URCU_TLS(urcu_qsbr_reader).node);
/*
* Assertion disabled because call_rcu threads are now rcu
* readers, and left running at exit.
- * assert(cds_list_empty(®istry));
+ * urcu_posix_assert(cds_list_empty(®istry));
*/
}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
#include <urcu/wfstack.h>
#include "urcu-die.h"
void urcu_adaptative_wake_up(struct urcu_wait_node *wait)
{
cmm_smp_mb();
- assert(uatomic_read(&wait->state) == URCU_WAIT_WAITING);
+ urcu_posix_assert(uatomic_read(&wait->state) == URCU_WAIT_WAITING);
uatomic_set(&wait->state, URCU_WAIT_WAKEUP);
if (!(uatomic_read(&wait->state) & URCU_WAIT_RUNNING)) {
if (futex_noasync(&wait->state, FUTEX_WAKE, 1,
}
while (!(uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN))
poll(NULL, 0, 10);
- assert(uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN);
+ urcu_posix_assert(uatomic_read(&wait->state) & URCU_WAIT_TEARDOWN);
}
static inline
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <poll.h>
#include <urcu/config.h>
+#include <urcu/assert.h>
#include <urcu/arch.h>
#include <urcu/wfcqueue.h>
#include <urcu/map/urcu.h>
void rcu_register_thread(void)
{
URCU_TLS(rcu_reader).tid = pthread_self();
- assert(URCU_TLS(rcu_reader).need_mb == 0);
- assert(!(URCU_TLS(rcu_reader).ctr & URCU_GP_CTR_NEST_MASK));
+ urcu_posix_assert(URCU_TLS(rcu_reader).need_mb == 0);
+ urcu_posix_assert(!(URCU_TLS(rcu_reader).ctr & URCU_GP_CTR_NEST_MASK));
mutex_lock(&rcu_registry_lock);
- assert(!URCU_TLS(rcu_reader).registered);
+ urcu_posix_assert(!URCU_TLS(rcu_reader).registered);
URCU_TLS(rcu_reader).registered = 1;
rcu_init(); /* In case gcc does not support constructor attribute */
cds_list_add(&URCU_TLS(rcu_reader).node, ®istry);
void rcu_unregister_thread(void)
{
mutex_lock(&rcu_registry_lock);
- assert(URCU_TLS(rcu_reader).registered);
+ urcu_posix_assert(URCU_TLS(rcu_reader).registered);
URCU_TLS(rcu_reader).registered = 0;
cds_list_del(&URCU_TLS(rcu_reader).node);
mutex_unlock(&rcu_registry_lock);
* application exits.
* Assertion disabled because call_rcu threads are now rcu
* readers, and left running at exit.
- * assert(cds_list_empty(®istry));
+ * urcu_posix_assert(cds_list_empty(®istry));
*/
}
#include <stdio.h>
#include <pthread.h>
#include <signal.h>
-#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sched.h>
#include "compat-getcpu.h"
+#include <urcu/assert.h>
#include <urcu/wfcqueue.h>
#include <urcu/pointer.h>
#include <urcu/list.h>
cds_wfcq_init(&cbs_tmp_head, &cbs_tmp_tail);
splice_ret = __cds_wfcq_splice_blocking(&cbs_tmp_head,
&cbs_tmp_tail, &workqueue->cbs_head, &workqueue->cbs_tail);
- assert(splice_ret != CDS_WFCQ_RET_WOULDBLOCK);
- assert(splice_ret != CDS_WFCQ_RET_DEST_NON_EMPTY);
+ urcu_posix_assert(splice_ret != CDS_WFCQ_RET_WOULDBLOCK);
+ urcu_posix_assert(splice_ret != CDS_WFCQ_RET_DEST_NON_EMPTY);
if (splice_ret != CDS_WFCQ_RET_SRC_EMPTY) {
if (workqueue->grace_period_fct)
workqueue->grace_period_fct(workqueue, workqueue->priv);
if (urcu_workqueue_destroy_worker(workqueue)) {
urcu_die(errno);
}
- assert(cds_wfcq_empty(&workqueue->cbs_head, &workqueue->cbs_tail));
+ urcu_posix_assert(cds_wfcq_empty(&workqueue->cbs_head, &workqueue->cbs_tail));
free(workqueue);
}
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
pthread_mutex_lock(&lock);
v = test_array.a;
- assert(v == 8);
+ urcu_posix_assert(v == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
pthread_mutex_unlock(&lock);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
urcu_mutex_lock(&per_thread_lock[tidx].lock);
v = test_array.a;
- assert(v == 8);
+ urcu_posix_assert(v == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
urcu_mutex_unlock(&per_thread_lock[tidx].lock);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <pthread.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include "thread-id.h"
perror("Error in pthread mutex lock");
exit(-1);
}
- assert(test_array.a == 8);
+ urcu_posix_assert(test_array.a == 8);
ret = pthread_mutex_unlock(&per_thread_lock[tidx].lock);
if (ret) {
perror("Error in pthread mutex unlock");
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
}
a = test_array.a;
- assert(a == 8);
+ urcu_posix_assert(a == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <pthread.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include "thread-id.h"
abort();
}
- assert(test_array.a == 8);
+ urcu_posix_assert(test_array.a == 8);
ret = pthread_rwlock_unlock(&lock);
if (ret) {
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
+#include <urcu/assert.h>
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
set_affinity();
rcu_register_thread();
- assert(!rcu_read_ongoing());
+ urcu_posix_assert(!rcu_read_ongoing());
while (!test_go)
{
for (;;) {
rcu_read_lock();
- assert(rcu_read_ongoing());
+ urcu_posix_assert(rcu_read_ongoing());
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(*local_ptr == 8);
+ urcu_posix_assert(*local_ptr == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
for (;;) {
new = malloc(sizeof(int));
- assert(new);
+ urcu_posix_assert(new);
*new = 8;
old = rcu_xchg_pointer(&test_rcu_pointer, new);
if (caa_unlikely(wduration))
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
int index;
index = array_index % ARRAY_SIZE;
- assert(test_array[index].a == ARRAY_POISON ||
+ urcu_posix_assert(test_array[index].a == ARRAY_POISON ||
test_array[index].a == 0);
ret = &test_array[index];
array_index++;
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
set_affinity();
rcu_register_thread();
- assert(!rcu_read_ongoing());
+ urcu_posix_assert(!rcu_read_ongoing());
while (!test_go)
{
for (;;) {
rcu_read_lock();
- assert(rcu_read_ongoing());
+ urcu_posix_assert(rcu_read_ongoing());
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(*local_ptr == 8);
+ urcu_posix_assert(*local_ptr == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
{
if (caa_unlikely(key1_len != key2_len))
return -1;
- assert(key1_len == sizeof(unsigned long));
+ urcu_posix_assert(key1_len == sizeof(unsigned long));
if (key1 == key2)
return 0;
else
int ret;
ret = cds_lfht_del(test_ht, cds_lfht_iter_get_node(&iter));
- assert(!ret);
+ urcu_posix_assert(!ret);
call_rcu(&node->head, free_node_cb);
count++;
}
*/
rcu_register_thread();
ret = (get_populate_hash_cb())();
- assert(!ret);
+ urcu_posix_assert(!ret);
rcu_thread_offline();
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <signal.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include <compat-rand.h>
#include "thread-id.h"
{
unsigned int key = (unsigned int) _key;
- assert(length == sizeof(unsigned int));
+ urcu_posix_assert(length == sizeof(unsigned int));
return hash_u32(&key, 1, seed);
}
#else
uint32_t v32[2];
} key;
- assert(length == sizeof(unsigned long));
+ urcu_posix_assert(length == sizeof(unsigned long));
v.v64 = (uint64_t) seed;
key.v64 = (uint64_t) _key;
hashword2(key.v32, 2, &v.v32[0], &v.v32[1]);
} else {
unsigned long v;
- assert(length == sizeof(unsigned long));
+ urcu_posix_assert(length == sizeof(unsigned long));
v = (unsigned long) _key;
return v % nr_hash_chains;
}
void cds_lfht_test_lookup(struct cds_lfht *ht, void *key, size_t key_len,
struct cds_lfht_iter *iter)
{
- assert(key_len == sizeof(unsigned long));
+ urcu_posix_assert(key_len == sizeof(unsigned long));
cds_lfht_lookup(ht, test_hash(key, key_len, TEST_HASH_SEED),
test_match, key, iter);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
test_end(&end_dequeues);
err = cds_lfq_destroy_rcu(&q);
- assert(!err);
+ urcu_posix_assert(!err);
printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
tot_enqueues, tot_dequeues);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
}
cmm_smp_mb();
- assert(test_pop || test_pop_all);
+ urcu_posix_assert(test_pop || test_pop_all);
for (;;) {
if (test_pop && test_pop_all) {
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
rcu_register_thread();
- assert(rcu_read_ongoing());
+ urcu_posix_assert(rcu_read_ongoing());
rcu_thread_offline();
- assert(!rcu_read_ongoing());
+ urcu_posix_assert(!rcu_read_ongoing());
rcu_thread_online();
while (!test_go)
for (;;) {
rcu_read_lock();
- assert(rcu_read_ongoing());
+ urcu_posix_assert(rcu_read_ongoing());
local_ptr = rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(*local_ptr == 8);
+ urcu_posix_assert(*local_ptr == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
for (;;) {
new = malloc(sizeof(int));
- assert(new);
+ urcu_posix_assert(new);
*new = 8;
old = rcu_xchg_pointer(&test_rcu_pointer, new);
if (caa_unlikely(wduration))
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include "../common/debug-yield.h"
local_ptr = _rcu_dereference(test_rcu_pointer);
rcu_debug_yield_read();
if (local_ptr)
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
if (caa_unlikely(rduration))
loop_sleep(rduration);
_rcu_read_unlock();
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include "thread-id.h"
#define _LGPL_SOURCE
_rcu_read_lock();
local_ptr = _rcu_dereference(test_rcu_pointer);
if (local_ptr) {
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
}
_rcu_read_unlock();
}
rcu_copy_mutex_lock();
old = test_rcu_pointer;
if (old) {
- assert(old->a == 8);
+ urcu_posix_assert(old->a == 8);
}
new->a = 8;
old = rcu_xchg_pointer(&test_rcu_pointer, new);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
+
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include "thread-id.h"
rcu_read_lock();
local_ptr = rcu_dereference(test_rcu_pointer);
if (local_ptr) {
- assert(local_ptr->a == 8);
+ urcu_posix_assert(local_ptr->a == 8);
}
rcu_read_unlock();
}
rcu_copy_mutex_lock();
old = test_rcu_pointer;
if (old) {
- assert(old->a == 8);
+ urcu_posix_assert(old->a == 8);
}
new->a = 8;
old = rcu_xchg_pointer(&test_rcu_pointer, new);
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include <urcu/uatomic.h>
#include "thread-id.h"
switch (ret) {
case CDS_WFCQ_RET_WOULDBLOCK:
- assert(0); /* blocking call */
+ urcu_posix_assert(0); /* blocking call */
break;
case CDS_WFCQ_RET_DEST_EMPTY:
URCU_TLS(nr_splice)++;
/* ok */
break;
case CDS_WFCQ_RET_DEST_NON_EMPTY:
- assert(0); /* entirely unexpected */
+ urcu_posix_assert(0); /* entirely unexpected */
break;
case CDS_WFCQ_RET_SRC_EMPTY:
/* ok, we could even skip iteration on dest if we wanted */
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include "thread-id.h"
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <errno.h>
#include <urcu/arch.h>
+#include <urcu/assert.h>
#include <urcu/tls-compat.h>
#include <urcu/uatomic.h>
#include "thread-id.h"
}
cmm_smp_mb();
- assert(test_pop || test_pop_all);
+ urcu_posix_assert(test_pop || test_pop_all);
for (;;) {
if (test_pop && test_pop_all) {
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>
-#include <assert.h>
#include <sched.h>
#include <errno.h>
+#include <urcu/assert.h>
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
rcu_read_unlock();
node = malloc(sizeof(*node));
- assert(node);
+ urcu_posix_assert(node);
call_rcu(&node->head, cb);