projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename all data structure with prefix cds_
[urcu.git]
/
urcu
/
wfqueue-static.h
diff --git
a/urcu/wfqueue-static.h
b/urcu/wfqueue-static.h
index 8a4a7fd8e2017d405f43e1b59de86dafb9ec4c99..4839c47a32d43030f4f39bad27b7b888c158a544 100644
(file)
--- a/
urcu/wfqueue-static.h
+++ b/
urcu/wfqueue-static.h
@@
-47,16
+47,16
@@
extern "C" {
#define WFQ_ADAPT_ATTEMPTS 10 /* Retry if being set */
#define WFQ_WAIT 10 /* Wait 10 ms if being set */
#define WFQ_ADAPT_ATTEMPTS 10 /* Retry if being set */
#define WFQ_WAIT 10 /* Wait 10 ms if being set */
-void _
wfq_node_init(struct
wfq_node *node)
+void _
cds_wfq_node_init(struct cds_
wfq_node *node)
{
node->next = NULL;
}
{
node->next = NULL;
}
-void _
wfq_init(struct
wfq_queue *q)
+void _
cds_wfq_init(struct cds_
wfq_queue *q)
{
int ret;
{
int ret;
- _wfq_node_init(&q->dummy);
+ _
cds_
wfq_node_init(&q->dummy);
/* Set queue head and tail */
q->head = &q->dummy;
q->tail = &q->dummy.next;
/* Set queue head and tail */
q->head = &q->dummy;
q->tail = &q->dummy.next;
@@
-64,9
+64,9
@@
void _wfq_init(struct wfq_queue *q)
assert(!ret);
}
assert(!ret);
}
-void _
wfq_enqueue(struct wfq_queue *q, struct
wfq_node *node)
+void _
cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_
wfq_node *node)
{
{
- struct wfq_node **old_tail;
+ struct
cds_
wfq_node **old_tail;
/*
* uatomic_xchg() implicit memory barrier orders earlier stores to data
/*
* uatomic_xchg() implicit memory barrier orders earlier stores to data
@@
-79,7
+79,7
@@
void _wfq_enqueue(struct wfq_queue *q, struct wfq_node *node)
* that the queue is being appended to. The following store will append
* "node" to the queue from a dequeuer perspective.
*/
* that the queue is being appended to. The following store will append
* "node" to the queue from a dequeuer perspective.
*/
- STORE_SHARED(*old_tail, node);
+
CAA_
STORE_SHARED(*old_tail, node);
}
/*
}
/*
@@
-90,28
+90,28
@@
void _wfq_enqueue(struct wfq_queue *q, struct wfq_node *node)
* thread to be scheduled. The queue appears empty until tail->next is set by
* enqueue.
*/
* thread to be scheduled. The queue appears empty until tail->next is set by
* enqueue.
*/
-struct wfq_node *
-__
wfq_dequeue_blocking(struct
wfq_queue *q)
+struct
cds_
wfq_node *
+__
_cds_wfq_dequeue_blocking(struct cds_
wfq_queue *q)
{
{
- struct wfq_node *node, *next;
+ struct
cds_
wfq_node *node, *next;
int attempt = 0;
/*
* Queue is empty if it only contains the dummy node.
*/
int attempt = 0;
/*
* Queue is empty if it only contains the dummy node.
*/
- if (q->head == &q->dummy && LOAD_SHARED(q->tail) == &q->dummy.next)
+ if (q->head == &q->dummy &&
CAA_
LOAD_SHARED(q->tail) == &q->dummy.next)
return NULL;
node = q->head;
/*
* Adaptative busy-looping waiting for enqueuer to complete enqueue.
*/
return NULL;
node = q->head;
/*
* Adaptative busy-looping waiting for enqueuer to complete enqueue.
*/
- while ((next = LOAD_SHARED(node->next)) == NULL) {
+ while ((next =
CAA_
LOAD_SHARED(node->next)) == NULL) {
if (++attempt >= WFQ_ADAPT_ATTEMPTS) {
poll(NULL, 0, WFQ_WAIT); /* Wait for 10ms */
attempt = 0;
} else
if (++attempt >= WFQ_ADAPT_ATTEMPTS) {
poll(NULL, 0, WFQ_WAIT); /* Wait for 10ms */
attempt = 0;
} else
- cpu_relax();
+ c
aa_c
pu_relax();
}
/*
* Move queue head forward.
}
/*
* Move queue head forward.
@@
-121,22
+121,22
@@
__wfq_dequeue_blocking(struct wfq_queue *q)
* Requeue dummy node if we just dequeued it.
*/
if (node == &q->dummy) {
* Requeue dummy node if we just dequeued it.
*/
if (node == &q->dummy) {
- _wfq_node_init(node);
- _wfq_enqueue(q, node);
- return __wfq_dequeue_blocking(q);
+ _
cds_
wfq_node_init(node);
+ _
cds_
wfq_enqueue(q, node);
+ return __
_cds_
wfq_dequeue_blocking(q);
}
return node;
}
}
return node;
}
-struct wfq_node *
-_
wfq_dequeue_blocking(struct
wfq_queue *q)
+struct
cds_
wfq_node *
+_
cds_wfq_dequeue_blocking(struct cds_
wfq_queue *q)
{
{
- struct wfq_node *retnode;
+ struct
cds_
wfq_node *retnode;
int ret;
ret = pthread_mutex_lock(&q->lock);
assert(!ret);
int ret;
ret = pthread_mutex_lock(&q->lock);
assert(!ret);
- retnode = __wfq_dequeue_blocking(q);
+ retnode = __
_cds_
wfq_dequeue_blocking(q);
ret = pthread_mutex_unlock(&q->lock);
assert(!ret);
return retnode;
ret = pthread_mutex_unlock(&q->lock);
assert(!ret);
return retnode;
This page took
0.045036 seconds
and
4
git commands to generate.