summaryrefslogtreecommitdiffstats
path: root/lib/qpnexus.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2009-12-16 15:46:12 +0000
committerpaulo <paul@bayleaf.org.uk>2009-12-16 15:46:12 +0000
commitf5e3efd6013ee104d3310b5910607034c552e4db (patch)
tree1320e0ae2a47a267b5521adf90edfdc912d51281 /lib/qpnexus.c
parentb69a458160a9ab354fb9350f605bd36310786304 (diff)
downloadquagga-f5e3efd6013ee104d3310b5910607034c552e4db.tar.bz2
quagga-f5e3efd6013ee104d3310b5910607034c552e4db.tar.xz
Fix race condition when threads start. Make memory stats thread safe
Run memory commands in cli thread.
Diffstat (limited to 'lib/qpnexus.c')
-rw-r--r--lib/qpnexus.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/qpnexus.c b/lib/qpnexus.c
index 0f949443..5a5c5417 100644
--- a/lib/qpnexus.c
+++ b/lib/qpnexus.c
@@ -122,7 +122,6 @@ qpn_exec(qpn_nexus qpn)
if (qpn->main_thread)
{
/* Run the state machine in calling thread */
- qpn->thread_id = qpt_thread_self();
qpn->start(qpn);
}
else
@@ -143,6 +142,8 @@ qpn_start_main(void* arg)
qtime_mono_t now;
sigset_t newmask;
+ qpn->thread_id = qpt_thread_self();
+
/* Main thread, block the message queue's signal */
sigemptyset (&newmask);
sigaddset (&newmask, SIGMQUEUE);
@@ -188,6 +189,8 @@ qpn_start_bgp(void* arg)
mqueue_block mqb;
sigset_t newmask;
+ qpn->thread_id = qpt_thread_self();
+
/*
* Not main thread. Block most signals, but be careful not to
* defer SIGTRAP because doing so breaks gdb, at least on