diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-03-29 21:16:28 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-11-30 22:17:58 +0100 |
commit | 419dfe6a7049c0ee7f469cc10724ea110bef3c9c (patch) | |
tree | 93c09b8621dcea6a3643738a2a2d01688b584107 /tests | |
parent | bgpd: remove unused `struct thread` from peer (diff) | |
download | frr-419dfe6a7049c0ee7f469cc10724ea110bef3c9c.tar.xz frr-419dfe6a7049c0ee7f469cc10724ea110bef3c9c.zip |
bgpd: dynamically allocate synchronization primitives
Changes all synchronization primitives to be dynamically allocated. This
should help catch any subtle errors in pthread lifecycles.
This change also pre-initializes synchronization primitives before
threads begin to run, eliminating a potential race condition that
probably would have caused a segfault on startup on a very fast box.
Also changes mutex and condition variable allocations to use
MTYPE_PTHREAD and updates tests to do the proper initializations.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bgpd/test_aspath.c | 2 | ||||
-rw-r--r-- | tests/bgpd/test_capability.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c index 46462d79c..5a508760b 100644 --- a/tests/bgpd/test_aspath.c +++ b/tests/bgpd/test_aspath.c @@ -29,6 +29,7 @@ #include "bgpd/bgpd.h" #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_attr.h" +#include "bgpd/bgp_packet.h" #define VT100_RESET "\x1b[0m" #define VT100_RED "\x1b[31m" @@ -1341,6 +1342,7 @@ int main(void) master = bm->master; bgp_option_set(BGP_OPT_NO_LISTEN); bgp_attr_init(); + peer_writes_init(); while (test_segments[i].name) { printf("test %u\n", i); diff --git a/tests/bgpd/test_capability.c b/tests/bgpd/test_capability.c index e8700a8b4..05c409647 100644 --- a/tests/bgpd/test_capability.c +++ b/tests/bgpd/test_capability.c @@ -903,6 +903,7 @@ int main(void) bgp_master_init(master); vrf_init(NULL, NULL, NULL, NULL); bgp_option_set(BGP_OPT_NO_LISTEN); + peer_writes_init(); if (fileno(stdout) >= 0) tty = isatty(fileno(stdout)); |