summaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-03-30 13:50:19 -0700
committerDamjan Marion <dmarion@me.com>2022-03-31 20:24:50 +0000
commit4b20830b496ade3f1e77cd5fcbdf6d6c7bb5336d (patch)
tree1c42e6c55f199011f651781da28417ce8e3e4208 /src/vlib/threads.h
parentb3a5b39efb48a67fa93d4329282345c0fc8a1f29 (diff)
vlib: add support for workers sync
Adds api that allows workers to synchronize through main thread. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1e75e2fb5144d397d19b13c4dfc7e937f11c044c
Diffstat (limited to 'src/vlib/threads.h')
-rw-r--r--src/vlib/threads.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vlib/threads.h b/src/vlib/threads.h
index e406dde5b07..b25d4764168 100644
--- a/src/vlib/threads.h
+++ b/src/vlib/threads.h
@@ -101,6 +101,9 @@ typedef struct
const char *barrier_caller;
const char *barrier_context;
volatile u32 *node_reforks_required;
+ volatile u32 wait_before_barrier;
+ volatile u32 workers_before_barrier;
+ volatile u32 done_work_before_barrier;
long lwp;
int cpu_id;
@@ -484,6 +487,17 @@ void vlib_rpc_call_main_thread (void *function, u8 * args, u32 size);
void vlib_get_thread_core_numa (vlib_worker_thread_t * w, unsigned cpu_id);
vlib_thread_main_t *vlib_get_thread_main_not_inline (void);
+/**
+ * Force workers sync from within worker
+ *
+ * Must be paired with @ref vlib_workers_continue
+ */
+void vlib_workers_sync (void);
+/**
+ * Release barrier after workers sync
+ */
+void vlib_workers_continue (void);
+
#endif /* included_vlib_threads_h */
/*