projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Install urcu/map/*.h into system
[urcu.git]
/
urcu
/
rculfstack-static.h
diff --git
a/urcu/rculfstack-static.h
b/urcu/rculfstack-static.h
index 49e5ef4adf905530d82577544d35ae6e1602f895..7caf3c8c0d15f344170c33873f4cb6f4b4d107fa 100644
(file)
--- a/
urcu/rculfstack-static.h
+++ b/
urcu/rculfstack-static.h
@@
-33,21
+33,21
@@
extern "C" {
#endif
extern "C" {
#endif
-void _
rcu_lfs_node_init(struct rcu_lfs_node
*node)
+void _
cds_lfs_node_init_rcu(struct cds_lfs_node_rcu
*node)
{
}
{
}
-void _
rcu_lfs_init(struct rcu_lfs_stack
*s)
+void _
cds_lfs_init_rcu(struct cds_lfs_stack_rcu
*s)
{
s->head = NULL;
}
{
s->head = NULL;
}
-void _
rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node
*node)
+void _
cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu
*node)
{
{
- struct
rcu_lfs_node
*head = NULL;
+ struct
cds_lfs_node_rcu
*head = NULL;
for (;;) {
for (;;) {
- struct
rcu_lfs_node
*old_head = head;
+ struct
cds_lfs_node_rcu
*old_head = head;
node->next = head;
/*
node->next = head;
/*
@@
-61,29
+61,33
@@
void _rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node)
}
/*
}
/*
+ * Should be called under rcu read-side lock.
+ *
* The caller must wait for a grace period to pass before freeing the returned
* The caller must wait for a grace period to pass before freeing the returned
- * node or modifying the
rcu_lfs_node
structure.
+ * node or modifying the
cds_lfs_node_rcu
structure.
* Returns NULL if stack is empty.
*/
* Returns NULL if stack is empty.
*/
-struct
rcu_lfs_node
*
-_
rcu_lfs_pop(struct rcu_lfs_stack
*s)
+struct
cds_lfs_node_rcu
*
+_
cds_lfs_pop_rcu(struct cds_lfs_stack_rcu
*s)
{
{
- struct rcu_lfs_node *head = NULL;
-
for (;;) {
for (;;) {
- struct rcu_lfs_node *old_head = head;
- struct rcu_lfs_node *next;
+ struct cds_lfs_node_rcu *head;
- if (head)
- next = head->next;
- else
- next = NULL;
+ head = rcu_dereference(s->head);
+ if (head) {
+ struct cds_lfs_node_rcu *next = rcu_dereference(head->next);
- head = uatomic_cmpxchg(&s->head, old_head, next);
- if (old_head == head)
- break;
+ if (uatomic_cmpxchg(&s->head, head, next) == head) {
+ return head;
+ } else {
+ /* Concurrent modification. Retry. */
+ continue;
+ }
+ } else {
+ /* Empty stack */
+ return NULL;
+ }
}
}
- return head;
}
#ifdef __cplusplus
}
#ifdef __cplusplus
This page took
0.024262 seconds
and
4
git commands to generate.