projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add ifdef cond around headers
[urcu.git]
/
urcu
/
rculfqueue.h
diff --git
a/urcu/rculfqueue.h
b/urcu/rculfqueue.h
index 32fca49a6cb126a38ad4342c31a23a74a091545f..808a16b8f18f0fd63c016169f2fb643ab83ed9fa 100644
(file)
--- a/
urcu/rculfqueue.h
+++ b/
urcu/rculfqueue.h
@@
-1,3
+1,6
@@
+#ifndef _URCU_RCULFQUEUE_H
+#define _URCU_RCULFQUEUE_H
+
/*
* rculfqueue.h
*
/*
* rculfqueue.h
*
@@
-72,11
+75,11
@@
void rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node)
* node before publication.
*/
* node before publication.
*/
- rcu_read_lock();
for (;;) {
for (;;) {
- struct rcu_lfq_node *tail = rcu_dereference(q->tail);
- struct rcu_lfq_node *next;
+ struct rcu_lfq_node *tail, *next;
+ rcu_read_lock();
+ tail = rcu_dereference(q->tail);
/*
* Typically expect tail->next to be NULL.
*/
/*
* Typically expect tail->next to be NULL.
*/
@@
-97,6
+100,7
@@
void rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node)
* further and retry.
*/
uatomic_cmpxchg(&q->tail, tail, next);
* further and retry.
*/
uatomic_cmpxchg(&q->tail, tail, next);
+ rcu_read_unlock();
continue;
}
}
continue;
}
}
@@
-113,11
+117,12
@@
void rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node)
struct rcu_lfq_node *
rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *))
{
struct rcu_lfq_node *
rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *))
{
- rcu_read_lock();
for (;;) {
for (;;) {
- struct rcu_lfq_node *head = rcu_dereference(q->head);
- struct rcu_lfq_node *next = rcu_dereference(head->next);
+ struct rcu_lfq_node *head, *next;
+ rcu_read_lock();
+ head = rcu_dereference(q->head);
+ next = rcu_dereference(head->next);
if (next) {
if (uatomic_cmpxchg(&q->head, head, next) == head) {
rcu_read_unlock();
if (next) {
if (uatomic_cmpxchg(&q->head, head, next) == head) {
rcu_read_unlock();
@@
-125,6
+130,7
@@
rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *))
return next;
} else {
/* Concurrently pushed, retry */
return next;
} else {
/* Concurrently pushed, retry */
+ rcu_read_unlock();
continue;
}
} else {
continue;
}
} else {
@@
-134,3
+140,5
@@
rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *))
}
}
}
}
}
}
+
+#endif /* _URCU_RCULFQUEUE_H */
This page took
0.023344 seconds
and
4
git commands to generate.