X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libust%2Ftracectl.c;h=03220373c92dee9c7eea7ee259d231de8924b809;hb=4267e589be114e837b06ad0b40fc58cdf7ea080a;hp=ef0155db3388441d83fe3afe813f66b5e78d64e3;hpb=223f2e7ce070406f507856fa8f0de508d8a05ad3;p=ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index ef0155d..0322037 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -15,6 +15,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* This file contains the implementation of the UST listener thread, which + * receives trace control commands. It also coordinates the initialization of + * libust. + */ + #define _GNU_SOURCE #include #include @@ -1065,8 +1070,9 @@ void create_listener(void) if(result) { PERROR("pthread_sigmask: %s", strerror(result)); } - - have_listener = 1; + else { + have_listener = 1; + } } static int init_socket(void) @@ -1364,10 +1370,13 @@ int restarting_usleep(useconds_t usecs) return result; } -static void stop_listener() +static void stop_listener(void) { int result; + if(!have_listener) + return; + result = pthread_cancel(listener_thread); if(result != 0) { ERR("pthread_cancel: %s", strerror(result));