X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=include%2Furcu%2Fstatic%2Flfstack.h;h=75db75ea3652adc37dea3835a89c1a03d1cfdb6b;hb=d3d3857f678627e7bbfb5a8d6f3bc15cd2a694d9;hp=b8b544feeed551121aeaf1ade5970e5eac9d0f8b;hpb=70469b43316ecc8d6053550504858ad8a8ef9b16;p=urcu.git diff --git a/include/urcu/static/lfstack.h b/include/urcu/static/lfstack.h index b8b544f..75db75e 100644 --- a/include/urcu/static/lfstack.h +++ b/include/urcu/static/lfstack.h @@ -1,34 +1,20 @@ +// SPDX-FileCopyrightText: 2010-2012 Mathieu Desnoyers +// +// 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 - * * 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 #include -#include +#include #include #include @@ -76,7 +62,7 @@ void _cds_lfs_init(struct cds_lfs_stack *s) s->head = NULL; ret = pthread_mutex_init(&s->lock, NULL); - assert(!ret); + urcu_posix_assert(!ret); } /* @@ -87,7 +73,7 @@ static inline void _cds_lfs_destroy(struct cds_lfs_stack *s) { int ret = pthread_mutex_destroy(&s->lock); - assert(!ret); + urcu_posix_assert(!ret); } /* @@ -267,7 +253,7 @@ static inline void _cds_lfs_pop_lock(struct cds_lfs_stack *s) int ret; ret = pthread_mutex_lock(&s->lock); - assert(!ret); + urcu_posix_assert(!ret); } /* @@ -278,7 +264,7 @@ static inline void _cds_lfs_pop_unlock(struct cds_lfs_stack *s) int ret; ret = pthread_mutex_unlock(&s->lock); - assert(!ret); + urcu_posix_assert(!ret); } /* @@ -289,9 +275,11 @@ struct cds_lfs_node * _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; } @@ -304,9 +292,11 @@ struct cds_lfs_head * _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; }