User Guide


Dangling Lock

Occurs when a task does not release a lock before the task ends.
Problem type: Dangling lock
Code Location
Allocation site
If present, represents the location and associated call stack when the lock was created.
Lock owned
If present, represents the location and its associated call stack when the lock was last acquired.
Parallel site
If present, represents the location and associated call stack of the site-begin annotation of the parallel site containing the task that acquired the lock.
void problem() {     ANNOTATE_SITE_BEGIN(dangle_site1); // Parallel site         ANNOTATE_TASK_BEGIN(task1);             ANNOTATE_LOCK_ACQUIRE(&dangle); // Lock owned         ANNOTATE_TASK_END(); // ...     ANNOTATE_SITE_END(); }
In this example:
  • There is a parallel site that contains a task.
  • The lock is acquired in the task.
  • The lock is not released before the end of the task - the
    annotation is missing.
Possible Correction Strategies
  • Make sure that an
    annotation is executed on every flow path from an
    annotation to the end of the task. If a code region has multiple exit flow paths, make sure the lock is released on all the paths.
  • Consider putting the lock-acquire and lock-release in the constructor and destructor of a static object, so that lock release happens automatically.
  • Consider putting a lock release in an exception handler if a the locked region might exit from an exception.

Product and Performance Information


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 reserverd 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