session: improve close procedure

Change-Id: I6201a044e70ab6a58db8212960c57edc77c41f96
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index b47a633..1794453 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -445,6 +445,14 @@
   return vm;
 }
 
+static inline u8
+vlib_thread_is_main_w_barrier (void)
+{
+  return (!vlib_num_workers ()
+	  || ((vlib_get_thread_index () == 0
+	       && vlib_worker_threads->wait_at_barrier[0])));
+}
+
 static inline void
 vlib_put_frame_queue_elt (vlib_frame_queue_elt_t * hf)
 {