X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu-defer.c;h=696ccae77db6c691c1172a6cd7c8b4eac5a88c09;hp=50aa066053850be20f4ac254e81296600fad79b7;hb=6abb4bd53503c325dc94b0c0f60b44b9550b462f;hpb=ddf7eefbdd2ff77c473534dfa89c3fe12c206d67 diff --git a/urcu-defer.c b/urcu-defer.c index 50aa066..696ccae 100644 --- a/urcu-defer.c +++ b/urcu-defer.c @@ -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, ®istry, 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(®istry)) return; - internal_rcu_lock(&rcu_defer_mutex); + mutex_lock(&rcu_defer_mutex); list_for_each_entry(index, ®istry, 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, ®istry, list) rcu_defer_barrier_queue(index, index->last_head); end: - internal_rcu_unlock(&rcu_defer_mutex); + mutex_unlock(&rcu_defer_mutex); } /* @@ -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(®istry); list_add(&defer_queue.list, ®istry); - 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(®istry); - 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)