fix: handle EINTR correctly in get_cpu_mask_from_sysfs
[urcu.git] / include / urcu / static / rculfstack.h
index 54ff377b8aa801bbeaddb07097e05428d6bc8e88..b44b9e29fdbad9b73024d653fb992218f221644b 100644 (file)
@@ -1,29 +1,15 @@
+// SPDX-FileCopyrightText: 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
 #ifndef _URCU_RCULFSTACK_STATIC_H
 #define _URCU_RCULFSTACK_STATIC_H
 
 /*
- * rculfstack-static.h
- *
  * Userspace RCU library - Lock-Free RCU Stack
  *
- * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * TO BE INCLUDED ONLY IN LGPL-COMPATIBLE CODE. See rculfstack.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 <urcu/uatomic.h>
@@ -83,7 +69,9 @@ int _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
                 * uatomic_cmpxchg() implicit memory barrier orders earlier
                 * stores to node before publication.
                 */
-               head = uatomic_cmpxchg(&s->head, old_head, node);
+               cmm_emit_legacy_smp_mb();
+               head = uatomic_cmpxchg_mo(&s->head, old_head, node,
+                                       CMM_SEQ_CST, CMM_SEQ_CST);
                if (old_head == head)
                        break;
        }
@@ -108,7 +96,9 @@ _cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
                if (head) {
                        struct cds_lfs_node_rcu *next = rcu_dereference(head->next);
 
-                       if (uatomic_cmpxchg(&s->head, head, next) == head) {
+                       if (uatomic_cmpxchg_mo(&s->head, head, next,
+                                               CMM_SEQ_CST, CMM_SEQ_CST) == head) {
+                               cmm_emit_legacy_smp_mb();
                                return head;
                        } else {
                                /* Concurrent modification. Retry. */
This page took 0.023557 seconds and 4 git commands to generate.