0 Replies Latest reply on Jul 26, 2013 8:40 AM by 880893

    Race detection in child processes




      the program given below creates a child process with two threads accessing a shared variable. Unfortunately, Thread Analyzer does not detect the race (neither version 12.0 nor 12.3). The race is only detected if it occurs in the parent process. Option "-F on/all" to instrument child processes does not work in conjunction with option "-r all" (the collect tool emits the error message "

      Race-detection data cannot be collected with any of -F -j -J -x"). Is this an inherent limitation of Thread Analyzer or is there a way to detect races and deadlocks in child processes?


      Thank you very much in advance for your help.




      #include <unistd.h>

      #include <stdlib.h>

      #include <assert.h>

      #include <pthread.h>


      int x;


      void* fun(void*)



          return NULL;



      int main ()


          x = 0;


          int pid = fork();

          assert(pid >= 0);


          if (pid == 0)


              /* Child process */

              pthread_t thread;

              assert(pthread_create(&thread, NULL, fun, NULL) == 0);


              assert(pthread_join(thread, NULL) == 0);





              /* Parent process */

              sleep (1);



          return 0;