summaryrefslogtreecommitdiff
path: root/lib/frr_pthread.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-02-03 21:34:02 -0500
committerDonald Sharp <sharpd@nvidia.com>2024-02-03 23:08:20 -0500
commit5ddf2aaa52e9f8977e902e437dd2036604ec7097 (patch)
tree21cb656e571d1b31ca9991993c17d42d7cc7dfa5 /lib/frr_pthread.c
parent3a6c3129ddda3509a9718f1a64341043dc3884ae (diff)
lib: Actually create the rcu and save it before using it
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>
Diffstat (limited to 'lib/frr_pthread.c')
-rw-r--r--lib/frr_pthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c
index f7e57136d6..1ffa5934aa 100644
--- a/lib/frr_pthread.c
+++ b/lib/frr_pthread.c
@@ -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;