X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=libust%2Ftracectl.c;h=97ab2eb1fb768433c4561733dcfded9b25cee235;hb=4d65ee62f53c9e3b7c7b56d2067ab347f3ce90aa;hp=a68dc7bd7e9e4a1684d753b6be5ce9da24d4f2a5;hpb=c39c72ee5890c7727ae2697f321ba1b3d6c862f5;p=lttng-ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index a68dc7bd..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; @@ -164,7 +171,8 @@ void process_blocked_consumers(void) idx++; } - result = poll(fds, n_fds, 0); + while((result = poll(fds, n_fds, 0)) == -1 && errno == EINTR) + /* nothing */; if(result == -1) { PERROR("poll"); return; @@ -223,6 +231,8 @@ void *listener_main(void *p) { int result; + ust_register_thread(); + DBG("LISTENER"); for(;;) { @@ -802,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);