+// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
#ifndef _URCU_STATIC_LFSTACK_H
#define _URCU_STATIC_LFSTACK_H
/*
- * urcu/static/lfstack.h
- *
* Userspace RCU library - Lock-Free Stack
*
- * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
* TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See urcu/lfstack.h for
* linking dynamically with the userspace rcu library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdbool.h>
#include <pthread.h>
-#include <assert.h>
+#include <urcu/assert.h>
#include <urcu/uatomic.h>
#include <urcu-pointer.h>
* cds_lfs_node_init: initialize lock-free stack node.
*/
static inline
-void _cds_lfs_node_init(struct cds_lfs_node *node)
+void _cds_lfs_node_init(struct cds_lfs_node *node __attribute__((unused)))
{
}
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);
}
/*
_cds_lfs_pop_blocking(struct cds_lfs_stack *s)
{
struct cds_lfs_node *retnode;
+ cds_lfs_stack_ptr_t stack;
_cds_lfs_pop_lock(s);
- retnode = ___cds_lfs_pop(s);
+ stack.s = s;
+ retnode = ___cds_lfs_pop(stack);
_cds_lfs_pop_unlock(s);
return retnode;
}
_cds_lfs_pop_all_blocking(struct cds_lfs_stack *s)
{
struct cds_lfs_head *rethead;
+ cds_lfs_stack_ptr_t stack;
_cds_lfs_pop_lock(s);
- rethead = ___cds_lfs_pop_all(s);
+ stack.s = s;
+ rethead = ___cds_lfs_pop_all(stack);
_cds_lfs_pop_unlock(s);
return rethead;
}