Tutorial: Analyzing Threading Errors with Intel® Inspector 2013 and a C++ Sample

Resolve Issue

To fix the detected threading error:

Investigate the Issue

The commenting embedded throughout the find_and_fix_threading_errors.cpp sample file reveals the cause of the data race problems: Multiple threads are concurrently accessing the global variable col. One possible correction strategy: Change the global variable to a local variable.

Access an Editor

Scroll to near line 80 in either code location region and double-click the color col; line in the Source tab to open the find_and_fix_threading_errors.cpp source file in an editor:
Editor

Change the Source Code

  1. Comment color col; and uncomment //color col; near line 88 to localize the variable col to the function render_one_pixel.

  2. Save your edits.

  3. Click the result tab to return to the Sources window.

    Note

    The Sources window data is unchanged because it is a snapshot of the source code at the time of analysis.

  4. Click the Summary button to display the Summary window.

Key Terms

Code location


Submit feedback on this help topic
Click here for more Tutorials

Studio-specific supplemental documentation may be available at <install-dir>/<studio>/documentation/.