Tutorial

  • 11/18/2019
  • Public Content

Resolve Issue

Intel® Inspector
is a dynamic memory and threading error checking tool for users developing serial and multithreaded applications on Windows* and Linux* operating systems. This topic is part of a
tutorial
that shows how to find and fix
threading
errors using the
Intel Inspector
and a
C++
sample application.
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.

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.
    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 redisplay the
    Summary
    window.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804