summaryrefslogtreecommitdiffstats
path: root/lib/vty.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2009-12-17 16:25:29 +0000
committerpaulo <paul@bayleaf.org.uk>2009-12-17 16:25:29 +0000
commit29e6ad6c07992d6a947d739d1665a95e817e6e9b (patch)
treed86b1aa9072cab272df2addaab69e0cb2df64851 /lib/vty.c
parent57c08de786262cfb59cbc691ac18712d0ac1e9e3 (diff)
downloadquagga-29e6ad6c07992d6a947d739d1665a95e817e6e9b.tar.bz2
quagga-29e6ad6c07992d6a947d739d1665a95e817e6e9b.tar.xz
Use static mutexes
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/vty.c b/lib/vty.c
index cc3a3951..f057536f 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -42,15 +42,15 @@
#include "qpnexus.h"
/* Needs to be qpthread safe */
-qpt_mutex_t* vty_mutex = NULL;
+qpt_mutex_t vty_mutex;
#ifdef NDEBUG
-#define LOCK qpt_mutex_lock(vty_mutex);
-#define UNLOCK qpt_mutex_unlock(vty_mutex);
+#define LOCK qpt_mutex_lock(&vty_mutex);
+#define UNLOCK qpt_mutex_unlock(&vty_mutex);
#else
int vty_lock_count = 0;
int vty_lock_asserted = 0;
-#define LOCK qpt_mutex_lock(vty_mutex);++vty_lock_count;
-#define UNLOCK --vty_lock_count;qpt_mutex_unlock(vty_mutex);
+#define LOCK qpt_mutex_lock(&vty_mutex);++vty_lock_count;
+#define UNLOCK --vty_lock_count;qpt_mutex_unlock(&vty_mutex);
#define ASSERTLOCKED if(vty_lock_count==0 && !vty_lock_asserted){vty_lock_asserted=1;assert(0);}
#endif
@@ -3591,7 +3591,7 @@ vty_init_r (qpn_nexus cli_n, qpn_nexus bgp_n)
{
cli_nexus = cli_n;
bgp_nexus = bgp_n;
- vty_mutex = qpt_mutex_init(vty_mutex, qpt_mutex_quagga);
+ qpt_mutex_init(&vty_mutex, qpt_mutex_quagga);
}
/* threads: Install vty's own commands like `who' command. */
@@ -3661,8 +3661,7 @@ vty_terminate (void)
}
UNLOCK
- if (vty_mutex)
- vty_mutex = qpt_mutex_destroy(vty_mutex, 1);
+ qpt_mutex_destroy(&vty_mutex, 0);
}
#undef LOCK