ut fast : use sigsuspend to be signal safe
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Mar 2006 18:32:11 +0000 (18:32 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Mar 2006 18:32:11 +0000 (18:32 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1629 04897980-b3bd-0310-b5e0-8ef037075253

usertrace-fast/Makefile
usertrace-fast/ltt-usertrace-fast.c

index d63a964802471531a5d05928be378b2af3d1cf82..7430a3b45589cdaf70a2415d2d766862a241a30a 100644 (file)
@@ -7,7 +7,7 @@ RANLIB=ranlib
 CC=gcc
 CFLAGS=-I. -O3
 #CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728
-#CFLAGS+=-DLTT_NULL_OUTPUT_TEST
+CFLAGS+=-DLTT_NULL_OUTPUT_TEST
 
 all: test sample-instrument-fct libltt-instrument-functions.a libltt-instrument-functions.so.0 sample-loop
 
index edc37b859ad94ac299a1ad5ec70c70ecc7f70e4c..0443a10bb4c6df7ed4915d22f4cf67620863554d 100644 (file)
@@ -375,6 +375,7 @@ get_error:
 static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info,
                sigset_t oldset, pid_t l_traced_pid, pthread_t l_traced_tid)
 {
+       sigset_t set;
        struct sigaction act;
        int ret;
        int fd_process;
@@ -406,12 +407,6 @@ static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info,
        sigaddset(&(act.sa_mask), SIGALRM);
        sigaction(SIGALRM, &act, NULL);
 
-       /* Enable signals */
-       ret = pthread_sigmask(SIG_SETMASK, &oldset, NULL);
-       if(ret) {
-               dbg_printf("LTT Error in pthread_sigmask\n");
-       }
-
        alarm(3);
 
        /* Open output files */
@@ -444,11 +439,15 @@ static void ltt_usertrace_fast_daemon(struct ltt_trace_info *shared_trace_info,
 #endif //LTT_NULL_OUTPUT_TEST
        
        while(1) {
-               pause();
+               ret = sigsuspend(&oldset);
+               if(ret) {
+                       perror("LTT Error in sigsuspend\n");
+               }
+               
                if(traced_pid == 0) break; /* parent died */
                if(parent_exited) break;
                dbg_printf("LTT Doing a buffer switch read. pid is : %lu\n", getpid());
-       
+
                do {
                        ret = read_subbuffer(&shared_trace_info->channel.process, fd_process);
                } while(ret == 0);
This page took 0.024987 seconds and 4 git commands to generate.