From 26cc701717a287000ac502bbadc451c3a0d76534 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Thu, 25 Jun 2009 22:51:21 -0400 Subject: [PATCH] initialize correctly urcu library --- libust/tracectl.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libust/tracectl.c b/libust/tracectl.c index 5ccd1f5..97ab2eb 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -26,6 +26,8 @@ #include #include +#include + #include "marker.h" #include "tracer.h" #include "localerr.h" @@ -106,8 +108,13 @@ void do_command(struct tracecmd *cmd) { } -void receive_commands() +/* This needs to be called whenever a new thread is created. It notifies + * liburcu of the new thread. + */ + +void ust_register_thread(void) { + rcu_register_thread(); } int fd_notif = -1; @@ -224,6 +231,8 @@ void *listener_main(void *p) { int result; + ust_register_thread(); + DBG("LISTENER"); for(;;) { @@ -803,6 +812,12 @@ static void auto_probe_connect(struct marker *m) static void __attribute__((constructor(101))) init0() { + /* Initialize RCU in case the constructor order is not good. */ + urcu_init(); + + /* It is important to do this before events start to be generated. */ + ust_register_thread(); + DBG("UST_AUTOPROBE constructor"); if(getenv("UST_AUTOPROBE")) { marker_set_new_marker_cb(auto_probe_connect); -- 2.34.1