Clang ThreadSanitizer - suppress main thread issues

Viewed 31

let's suppose I have following output from ThreadSanitizer

WARNING: ThreadSanitizer: data race (pid=19219)
  Write of size 4 at 0x7fcf47b21bc0 by thread T1:
    #0 Thread1 tiny_race.c:4 (exe+0x00000000a360)

  Previous write of size 4 at 0x7fcf47b21bc0 by main thread:
    #0 main tiny_race.c:10 (exe+0x00000000a3b4)

  Thread T1 (running) created at:
    #0 pthread_create tsan_interceptors.cc:705 (exe+0x00000000c790)
    #1 main tiny_race.c:9 (exe+0x00000000a3a4)

Is there a way, how I can suppress all warning caused by conflict by main thread? Or is there a way, how to suppress all warning caused by some function recursively?

I have found, there is suppression file with possibilities:

# Global var global_var is racy
race:global_var

# short() function is racy, but this not work recursively
race:^short$

# The following thread leaks, but thread:main doesn't work for me
thread:MonitoringThread

Background: I have an embeded SW with a RTOS which I need to test for races. For this reason, I compile and run this SW in a Linux enviroment. In the main function (main thread) all threats are created, lots of variables are initialized and after all at the end the scheduler is started. I want somehow be aware of all warnings before the scheduler is started.

0 Answers
Related