projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: update automake following README to README.md change
[urcu.git]
/
urcu
/
static
/
rculfqueue.h
diff --git
a/urcu/static/rculfqueue.h
b/urcu/static/rculfqueue.h
index 99335c41ec41d33078279e2f843431111cf307e8..af73c6f2ef7565dc69e16f62d539ded7ed66d583 100644
(file)
--- a/
urcu/static/rculfqueue.h
+++ b/
urcu/static/rculfqueue.h
@@
-28,6
+28,7
@@
#include <urcu-call-rcu.h>
#include <urcu/uatomic.h>
#include <urcu-call-rcu.h>
#include <urcu/uatomic.h>
+#include <urcu-pointer.h>
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
@@
-88,7
+89,7
@@
void rcu_free_dummy(struct cds_lfq_node_rcu *node)
assert(node->dummy);
dummy = caa_container_of(node, struct cds_lfq_node_rcu_dummy, parent);
assert(node->dummy);
dummy = caa_container_of(node, struct cds_lfq_node_rcu_dummy, parent);
- call_rcu(&dummy->head, free_dummy_cb);
+
dummy->q->queue_
call_rcu(&dummy->head, free_dummy_cb);
}
static inline
}
static inline
@@
-109,10
+110,13
@@
void _cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node)
}
static inline
}
static inline
-void _cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q)
+void _cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q,
+ void queue_call_rcu(struct rcu_head *head,
+ void (*func)(struct rcu_head *head)))
{
q->tail = make_dummy(q, NULL);
q->head = q->tail;
{
q->tail = make_dummy(q, NULL);
q->head = q->tail;
+ q->queue_call_rcu = queue_call_rcu;
}
/*
}
/*
@@
-133,7
+137,7
@@
int _cds_lfq_destroy_rcu(struct cds_lfq_queue_rcu *q)
}
/*
}
/*
- *
Acts as a RCU reader
.
+ *
Should be called under rcu read lock critical section
.
*/
static inline
void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
*/
static inline
void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
@@
-147,7
+151,6
@@
void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
for (;;) {
struct cds_lfq_node_rcu *tail, *next;
for (;;) {
struct cds_lfq_node_rcu *tail, *next;
- rcu_read_lock();
tail = rcu_dereference(q->tail);
next = uatomic_cmpxchg(&tail->next, NULL, node);
if (next == NULL) {
tail = rcu_dereference(q->tail);
next = uatomic_cmpxchg(&tail->next, NULL, node);
if (next == NULL) {
@@
-157,7
+160,6
@@
void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
* enqueue might beat us to it, that's fine).
*/
(void) uatomic_cmpxchg(&q->tail, tail, node);
* enqueue might beat us to it, that's fine).
*/
(void) uatomic_cmpxchg(&q->tail, tail, node);
- rcu_read_unlock();
return;
} else {
/*
return;
} else {
/*
@@
-165,7
+167,6
@@
void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q,
* Help moving tail further and retry.
*/
(void) uatomic_cmpxchg(&q->tail, tail, next);
* Help moving tail further and retry.
*/
(void) uatomic_cmpxchg(&q->tail, tail, next);
- rcu_read_unlock();
continue;
}
}
continue;
}
}
@@
-182,7
+183,7
@@
void enqueue_dummy(struct cds_lfq_queue_rcu *q)
}
/*
}
/*
- *
Acts as a RCU reader
.
+ *
Should be called under rcu read lock critical section
.
*
* The caller must wait for a grace period to pass before freeing the returned
* node or modifying the cds_lfq_node_rcu structure.
*
* The caller must wait for a grace period to pass before freeing the returned
* node or modifying the cds_lfq_node_rcu structure.
@@
-194,13
+195,10
@@
struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q)
for (;;) {
struct cds_lfq_node_rcu *head, *next;
for (;;) {
struct cds_lfq_node_rcu *head, *next;
- rcu_read_lock();
head = rcu_dereference(q->head);
next = rcu_dereference(head->next);
head = rcu_dereference(q->head);
next = rcu_dereference(head->next);
- if (head->dummy && next == NULL) {
- rcu_read_unlock();
+ if (head->dummy && next == NULL)
return NULL; /* empty */
return NULL; /* empty */
- }
/*
* We never, ever allow dequeue to get to a state where
* the queue is empty (we need at least one node in the
/*
* We never, ever allow dequeue to get to a state where
* the queue is empty (we need at least one node in the
@@
-212,17
+210,13
@@
struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q)
enqueue_dummy(q);
next = rcu_dereference(head->next);
}
enqueue_dummy(q);
next = rcu_dereference(head->next);
}
- if (uatomic_cmpxchg(&q->head, head, next) != head) {
- rcu_read_unlock();
+ if (uatomic_cmpxchg(&q->head, head, next) != head)
continue; /* Concurrently pushed. */
continue; /* Concurrently pushed. */
- }
if (head->dummy) {
/* Free dummy after grace period. */
rcu_free_dummy(head);
if (head->dummy) {
/* Free dummy after grace period. */
rcu_free_dummy(head);
- rcu_read_unlock();
continue; /* try again */
}
continue; /* try again */
}
- rcu_read_unlock();
return head;
}
}
return head;
}
}
This page took
0.024247 seconds
and
4
git commands to generate.