vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()

Type: improvement
Change-Id: If3da7d4338470912f37ff1794620418d928fb77f
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/session/session_debug.c b/src/vnet/session/session_debug.c
index c042e9e..349d1ec 100644
--- a/src/vnet/session/session_debug.c
+++ b/src/vnet/session/session_debug.c
@@ -120,7 +120,7 @@
 void
 dump_thread_0_event_queue (void)
 {
-  vlib_main_t *vm = &vlib_global_main;
+  vlib_main_t *vm = vlib_get_first_main ();
   u32 my_thread_index = vm->thread_index;
   session_event_t _e, *e = &_e;
   svm_msg_q_shared_queue_t *sq;