diff options
author | paulo <paul@bayleaf.org.uk> | 2009-12-14 17:38:26 +0000 |
---|---|---|
committer | paulo <paul@bayleaf.org.uk> | 2009-12-14 17:38:26 +0000 |
commit | 73fe495cffb7eae3f68df3d3598b0f83df81b79a (patch) | |
tree | 2e67e49a094ad232bf883b6e5141798da03fa6f9 /lib/vty.c | |
parent | 9035f1d22beec82507c1c9137e7c9fb5c4d0fbc6 (diff) | |
download | quagga-73fe495cffb7eae3f68df3d3598b0f83df81b79a.tar.bz2 quagga-73fe495cffb7eae3f68df3d3598b0f83df81b79a.tar.xz |
Using message queue to send commands from cli thread to bgp thread.
Diffstat (limited to 'lib/vty.c')
-rw-r--r-- | lib/vty.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -139,6 +139,7 @@ char integrate_default[] = SYSCONFDIR INTEGRATE_DEFAULT_CONFIG; /* Master of the threads. */ static struct thread_master *master = NULL; static qpn_nexus cli_nexus = NULL; +static qpn_nexus bgp_nexus = NULL; /* VTY standard output function. vty == NULL or VTY_SHELL => stdout */ int @@ -226,6 +227,13 @@ uty_vout(struct vty *vty, const char *format, va_list args) XFREE (MTYPE_VTY_OUT_BUF, p); } + if (cli_nexus != NULL && qpt_thread_self() != cli_nexus->thread_id) + { + /* Wake up */ + vty_event (VTY_WRITE, vty->fd, vty); + qpt_thread_signal(cli_nexus->thread_id, SIGMQUEUE); + } + return len; } @@ -546,7 +554,7 @@ vty_command (struct vty *vty, char *buf) #endif /* CONSUMED_TIME_CHECK */ UNLOCK - ret = cmd_execute_command (vline, vty, NULL, 0); + ret = cmd_execute_command (vline, vty, NULL, bgp_nexus, 0); LOCK /* Get the name of the protocol if any */ @@ -3465,9 +3473,10 @@ vty_init_vtysh () /* qpthreads: Install vty's own commands like `who' command. */ void -vty_init_r (qpn_nexus qpn) +vty_init_r (qpn_nexus cli_n, qpn_nexus bgp_n) { - cli_nexus = qpn; + cli_nexus = cli_n; + bgp_nexus = bgp_n; vty_mutex = qpt_mutex_init(vty_mutex, qpt_mutex_quagga); } |