X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=urcu-defer.c;h=3efe5ba2a5a47ccaff0a2f956efa957fb71bde01;hb=3dce4bfa7f900ff196168412382b1e54d776ddfe;hp=5e4650ff003b4c8d97ff0fb240a0d14fa4d8660a;hpb=2c22932bff02d0124579d70c67695ce2a439006a;p=userspace-rcu.git diff --git a/urcu-defer.c b/urcu-defer.c index 5e4650f..3efe5ba 100644 --- a/urcu-defer.c +++ b/urcu-defer.c @@ -49,13 +49,13 @@ extern void synchronize_rcu(void); static pthread_mutex_t urcu_defer_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t defer_thread_mutex = PTHREAD_MUTEX_INITIALIZER; -int defer_thread_futex; +static int defer_thread_futex; /* * Written to only by each individual deferer. Read by both the deferer and * the reclamation tread. */ -struct defer_queue __thread defer_queue; +static struct defer_queue __thread defer_queue; /* Thread IDs of registered deferers */ #define INIT_NUM_THREADS 4 @@ -76,10 +76,11 @@ static pthread_t tid_defer; */ static void wake_up_defer(void) { - if (unlikely(atomic_read(&defer_thread_futex) == -1)) + if (unlikely(atomic_read(&defer_thread_futex) == -1)) { atomic_set(&defer_thread_futex, 0); - futex(&defer_thread_futex, FUTEX_WAKE, - 0, NULL, NULL, 0); + futex(&defer_thread_futex, FUTEX_WAKE, 0, + NULL, NULL, 0); + } } /* @@ -289,21 +290,15 @@ void *thr_defer(void *args) { for (;;) { pthread_testcancel(); - printf("a\n"); /* * "Be green". Don't wake up the CPU if there is no RCU work * to perform whatsoever. Aims at saving laptop battery life by * leaving the processor in sleep state when idle. */ - printf("b\n"); wait_defer(); - printf("e\n"); /* Sleeping after wait_defer to let many callbacks enqueue */ - //TEST poll(NULL,0,100); /* wait for 100ms */ - printf("f\n"); + poll(NULL,0,100); /* wait for 100ms */ rcu_defer_barrier(); - printf("perform deferred call_rcu() from worker thread %lu.\n", - time(NULL)); } return NULL;