initialize correctly urcu library
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 26 Jun 2009 02:51:21 +0000 (22:51 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 26 Jun 2009 02:51:21 +0000 (22:51 -0400)
libust/tracectl.c

index 5ccd1f5eba14b0846223f297ea78408c9af37fa0..97ab2eb1fb768433c4561733dcfded9b25cee235 100644 (file)
@@ -26,6 +26,8 @@
 #include <fcntl.h>
 #include <poll.h>
 
+#include <urcu.h>
+
 #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);
This page took 0.02434 seconds and 4 git commands to generate.