Fix powerpc uatomic 4-byte cmpxchg (cmpd -> cmpw)
[urcu.git] / urcu-defer.c
index 50aa066053850be20f4ac254e81296600fad79b7..92635ed3cca4c1f45390bfac5348714722f56547 100644 (file)
@@ -57,7 +57,7 @@ static struct defer_queue __thread defer_queue;
 static LIST_HEAD(registry);
 static pthread_t tid_defer;
 
-static void internal_rcu_lock(pthread_mutex_t *mutex)
+static void mutex_lock(pthread_mutex_t *mutex)
 {
        int ret;
 
@@ -80,7 +80,7 @@ static void internal_rcu_lock(pthread_mutex_t *mutex)
 #endif /* #else #ifndef DISTRUST_SIGNALS_EXTREME */
 }
 
-static void internal_rcu_unlock(pthread_mutex_t *mutex)
+static void mutex_unlock(pthread_mutex_t *mutex)
 {
        int ret;
 
@@ -108,12 +108,12 @@ static unsigned long rcu_defer_num_callbacks(void)
        unsigned long num_items = 0, head;
        struct defer_queue *index;
 
-       internal_rcu_lock(&rcu_defer_mutex);
+       mutex_lock(&rcu_defer_mutex);
        list_for_each_entry(index, &registry, list) {
                head = LOAD_SHARED(index->head);
                num_items += head - index->tail;
        }
-       internal_rcu_unlock(&rcu_defer_mutex);
+       mutex_unlock(&rcu_defer_mutex);
        return num_items;
 }
 
@@ -184,9 +184,9 @@ static void _rcu_defer_barrier_thread(void)
 
 void rcu_defer_barrier_thread(void)
 {
-       internal_rcu_lock(&rcu_defer_mutex);
+       mutex_lock(&rcu_defer_mutex);
        _rcu_defer_barrier_thread();
-       internal_rcu_unlock(&rcu_defer_mutex);
+       mutex_unlock(&rcu_defer_mutex);
 }
 
 /*
@@ -210,7 +210,7 @@ void rcu_defer_barrier(void)
        if (list_empty(&registry))
                return;
 
-       internal_rcu_lock(&rcu_defer_mutex);
+       mutex_lock(&rcu_defer_mutex);
        list_for_each_entry(index, &registry, list) {
                index->last_head = LOAD_SHARED(index->head);
                num_items += index->last_head - index->tail;
@@ -226,7 +226,7 @@ void rcu_defer_barrier(void)
        list_for_each_entry(index, &registry, list)
                rcu_defer_barrier_queue(index, index->last_head);
 end:
-       internal_rcu_unlock(&rcu_defer_mutex);
+       mutex_unlock(&rcu_defer_mutex);
 }
 
 /*
@@ -247,7 +247,7 @@ void _defer_rcu(void (*fct)(void *p), void *p)
         * If queue is full, or reached threshold. Empty queue ourself.
         * Worse-case: must allow 2 supplementary entries for fct pointer.
         */
-       if (unlikely(sync || (head - tail >= DEFER_QUEUE_SIZE - 2))) {
+       if (unlikely(head - tail >= DEFER_QUEUE_SIZE - 2)) {
                assert(head - tail <= DEFER_QUEUE_SIZE);
                rcu_defer_barrier_thread();
                assert(head - LOAD_SHARED(defer_queue.tail) == 0);
@@ -347,33 +347,33 @@ void rcu_defer_register_thread(void)
        assert(defer_queue.q == NULL);
        defer_queue.q = malloc(sizeof(void *) * DEFER_QUEUE_SIZE);
 
-       internal_rcu_lock(&defer_thread_mutex);
-       internal_rcu_lock(&rcu_defer_mutex);
+       mutex_lock(&defer_thread_mutex);
+       mutex_lock(&rcu_defer_mutex);
        was_empty = list_empty(&registry);
        list_add(&defer_queue.list, &registry);
-       internal_rcu_unlock(&rcu_defer_mutex);
+       mutex_unlock(&rcu_defer_mutex);
 
        if (was_empty)
                start_defer_thread();
-       internal_rcu_unlock(&defer_thread_mutex);
+       mutex_unlock(&defer_thread_mutex);
 }
 
 void rcu_defer_unregister_thread(void)
 {
        int is_empty;
 
-       internal_rcu_lock(&defer_thread_mutex);
-       internal_rcu_lock(&rcu_defer_mutex);
+       mutex_lock(&defer_thread_mutex);
+       mutex_lock(&rcu_defer_mutex);
        list_del(&defer_queue.list);
        _rcu_defer_barrier_thread();
        free(defer_queue.q);
        defer_queue.q = NULL;
        is_empty = list_empty(&registry);
-       internal_rcu_unlock(&rcu_defer_mutex);
+       mutex_unlock(&rcu_defer_mutex);
 
        if (is_empty)
                stop_defer_thread();
-       internal_rcu_unlock(&defer_thread_mutex);
+       mutex_unlock(&defer_thread_mutex);
 }
 
 void rcu_defer_exit(void)
This page took 0.025003 seconds and 4 git commands to generate.