]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: handle frr_pthread_init/fini in libfrr init
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 9 Aug 2019 18:03:01 +0000 (18:03 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 16 Sep 2019 16:12:04 +0000 (16:12 +0000)
Make sure we are always cleaning init'ing and cleaning up pthread infra.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgpd.c
lib/libfrr.c
zebra/main.c

index 5b31fbb3a8c140cb8d77d460fbe74ac3d29d3ace..572279b0ed3d7d11188a1b95c6dfbbe9c4810384 100644 (file)
@@ -7931,8 +7931,6 @@ static void bgp_pthreads_init(void)
        assert(!bgp_pth_io);
        assert(!bgp_pth_ka);
 
-       frr_pthread_init();
-
        struct frr_pthread_attr io = {
                .start = frr_pthread_attr_default.start,
                .stop = frr_pthread_attr_default.stop,
@@ -7958,7 +7956,6 @@ void bgp_pthreads_run(void)
 void bgp_pthreads_finish(void)
 {
        frr_pthread_stop_all();
-       frr_pthread_finish();
 }
 
 void bgp_init(unsigned short instance)
index 4301dc20ad957c95661e6d67075df516f4ada59f..478fe4e20523398f29c77f99b7a8a373b2716452 100644 (file)
@@ -42,6 +42,7 @@
 #include "northbound_db.h"
 #include "debug.h"
 #include "frrcu.h"
+#include "frr_pthread.h"
 
 DEFINE_HOOK(frr_late_init, (struct thread_master * tm), (tm))
 DEFINE_KOOH(frr_early_fini, (), ())
@@ -681,6 +682,8 @@ struct thread_master *frr_init(void)
        memory_init();
        log_filter_cmd_init();
 
+       frr_pthread_init();
+
        log_ref_init();
        log_ref_vty_init();
        lib_error_init();
@@ -1076,6 +1079,7 @@ void frr_fini(void)
        db_close();
 #endif
        log_ref_fini();
+       frr_pthread_finish();
        zprivs_terminate(di->privs);
        /* signal_init -> nothing needed */
        thread_master_free(master);
index 657d1247e94638015ee97a26e9bb69f2876a52a5..99607c0d78a72b7a4a9f5b3b928d187e42c9f326 100644 (file)
@@ -36,7 +36,6 @@
 #include "vrf.h"
 #include "libfrr.h"
 #include "routemap.h"
-#include "frr_pthread.h"
 
 #include "zebra/zebra_router.h"
 #include "zebra/zebra_errors.h"
@@ -375,9 +374,6 @@ int main(int argc, char **argv)
 
        zrouter.master = frr_init();
 
-       /* Initialize pthread library */
-       frr_pthread_init();
-
        /* Zebra related initialize. */
        zebra_router_init();
        zserv_init();