From: Pierre-Marc Fournier Date: Fri, 26 Jun 2009 02:51:21 +0000 (-0400) Subject: initialize correctly urcu library X-Git-Tag: v1.9.1~956 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=26cc701717a287000ac502bbadc451c3a0d76534;p=lttng-ust.git initialize correctly urcu library --- diff --git a/libust/tracectl.c b/libust/tracectl.c index 5ccd1f5e..97ab2eb1 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);