4.3 Perform Thread Safety Check

Use Thread Safety Check to search source files for static local variables used by multiple threads. Violations are identified with “Local constant static variable varname, dangerous if it is initialized in parallel threads” for C++03 or “Local static variable varname” otherwise.

The results of this check can be output in the same manner as MISRA Check:

  • Output window: Under the “MISRA Check” tab.
  • HTML report file: Enable in Tools>Options>Embedded>MISRA Check.
  • CSV report file: Enable in Tools>Options>Embedded>MISRA Check.

Thread Safety Check Project

To Thread Safety Check all the files in a project:

  • Right click on the project name in the Projects window and select Analysis>Threadsafety Check Project.
  • Select Tools>Analysis>MISRA Check>Threadsafety Check Main Project.
  • Click on the SRC icon menu and select Threadsafety Check Main Project (see figure below).
Figure 4-1. MISRA Check Main Project (SRC) Icon Menu

Thread Safety Check File

To Thread Safety Check a single file:

  1. In the Projects window, select the file you want to check under Source Files.
  2. Right click on the source file and select Threadsafety Check File.
Figure 4-2. Thread Safety Check on File Context Menu