aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/threads.h')
-rw-r--r--src/vlib/threads.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index b514ba415ec..d715ebfff58 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -19,8 +19,6 @@
#include <vppinfra/callback.h>
#include <linux/sched.h>
-extern vlib_main_t **vlib_mains;
-
void vlib_set_thread_name (char *name);
/* arg is actually a vlib__thread_t * */
@@ -239,28 +237,29 @@ typedef enum
void vlib_worker_thread_fork_fixup (vlib_fork_fixup_t which);
-#define foreach_vlib_main(body) \
-do { \
- vlib_main_t ** __vlib_mains = 0, *this_vlib_main; \
- int ii; \
- \
- for (ii = 0; ii < vec_len (vlib_mains); ii++) \
- { \
- this_vlib_main = vlib_mains[ii]; \
- ASSERT (ii == 0 || \
- this_vlib_main->parked_at_barrier == 1); \
- if (this_vlib_main) \
- vec_add1 (__vlib_mains, this_vlib_main); \
- } \
- \
- for (ii = 0; ii < vec_len (__vlib_mains); ii++) \
- { \
- this_vlib_main = __vlib_mains[ii]; \
- /* body uses this_vlib_main... */ \
- (body); \
- } \
- vec_free (__vlib_mains); \
-} while (0);
+#define foreach_vlib_main(body) \
+ do \
+ { \
+ vlib_main_t **__vlib_mains = 0, *this_vlib_main; \
+ int ii; \
+ \
+ for (ii = 0; ii < vec_len (vlib_global_main.vlib_mains); ii++) \
+ { \
+ this_vlib_main = vlib_global_main.vlib_mains[ii]; \
+ ASSERT (ii == 0 || this_vlib_main->parked_at_barrier == 1); \
+ if (this_vlib_main) \
+ vec_add1 (__vlib_mains, this_vlib_main); \
+ } \
+ \
+ for (ii = 0; ii < vec_len (__vlib_mains); ii++) \
+ { \
+ this_vlib_main = __vlib_mains[ii]; \
+ /* body uses this_vlib_main... */ \
+ (body); \
+ } \
+ vec_free (__vlib_mains); \
+ } \
+ while (0);
#define foreach_sched_policy \
_(SCHED_OTHER, OTHER, "other") \
@@ -402,6 +401,7 @@ vlib_worker_thread_barrier_check (void)
{
if (PREDICT_FALSE (*vlib_worker_threads->wait_at_barrier))
{
+ vlib_global_main_t *vgm = vlib_get_global_main ();
vlib_main_t *vm = vlib_get_main ();
u32 thread_index = vm->thread_index;
f64 t = vlib_time_now (vm);
@@ -448,7 +448,7 @@ vlib_worker_thread_barrier_check (void)
f64 now;
vm->time_offset = 0.0;
now = vlib_time_now (vm);
- vm->time_offset = vlib_global_main.time_last_barrier_release - now;
+ vm->time_offset = vgm->vlib_mains[0]->time_last_barrier_release - now;
vm->time_last_barrier_release = vlib_time_now (vm);
}