]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Actually create the rcu and save it before using it
authorDonald Sharp <sharpd@nvidia.com>
Sun, 4 Feb 2024 02:34:02 +0000 (21:34 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 4 Feb 2024 04:08:20 +0000 (23:08 -0500)
In a non-controlled startup, the rcu data structures were
not being created until after logging could happen.  This
is bad.  Move it so that the rcu data structures are
created first, before logging( HA! ) can happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/frr_pthread.c

index f7e57136d607ddee519bfa31efe33ff30592e3af..1ffa5934aa5bd0ef2b32794104255127a86943fe 100644 (file)
@@ -234,6 +234,10 @@ static void *frr_pthread_attr_non_controlled_start(void *arg)
 int frr_pthread_non_controlled_startup(pthread_t thread, const char *name,
                                       const char *os_name)
 {
+       struct rcu_thread *rcu_thread = rcu_thread_new(NULL);
+
+       rcu_thread_start(rcu_thread);
+
        struct frr_pthread_attr attr = {
                .start = frr_pthread_attr_non_controlled_start,
                .stop = frr_pthread_attr_default.stop,
@@ -245,7 +249,7 @@ int frr_pthread_non_controlled_startup(pthread_t thread, const char *name,
                return -1;
 
        fpt->thread = thread;
-       fpt->rcu_thread = rcu_thread_new(NULL);
+       fpt->rcu_thread = rcu_thread;
        frr_pthread_inner(fpt);
 
        return 0;