urcu-defer: handle malloc error value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 31 Dec 2010 17:50:59 +0000 (12:50 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 31 Dec 2010 17:50:59 +0000 (12:50 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-defer.c
urcu-defer.h

index 28bb18ccc2f33f607f1d9b4dfc9c4c4da4d0eeef..3f596ae14882e4a635529baa663312b33b2ad247 100644 (file)
@@ -339,13 +339,15 @@ static void stop_defer_thread(void)
        assert(!ret);
 }
 
-void rcu_defer_register_thread(void)
+int rcu_defer_register_thread(void)
 {
        int was_empty;
 
        assert(defer_queue.last_head == 0);
        assert(defer_queue.q == NULL);
        defer_queue.q = malloc(sizeof(void *) * DEFER_QUEUE_SIZE);
+       if (!defer_queue.q)
+               return -ENOMEM;
 
        mutex_lock(&defer_thread_mutex);
        mutex_lock(&rcu_defer_mutex);
@@ -356,6 +358,7 @@ void rcu_defer_register_thread(void)
        if (was_empty)
                start_defer_thread();
        mutex_unlock(&defer_thread_mutex);
+       return 0;
 }
 
 void rcu_defer_unregister_thread(void)
index e161616302383167f4e4e5002e2d12cbae8df05d..2019e133f2bbe0552746b00450a074a1ba9cfe2c 100644 (file)
@@ -63,7 +63,7 @@ extern void defer_rcu(void (*fct)(void *p), void *p);
 /*
  * Thread registration for reclamation.
  */
-extern void rcu_defer_register_thread(void);
+extern int rcu_defer_register_thread(void);
 extern void rcu_defer_unregister_thread(void);
 extern void rcu_defer_barrier(void);
 extern void rcu_defer_barrier_thread(void);
This page took 0.025388 seconds and 4 git commands to generate.