With Intel TBB, you can associate a mutex with a shared object to enforce mutually exclusive access to that object. A mutex is either locked or unlocked. For a thread to safely access the object:

  • The thread acquires a lock on the mutex.

  • The thread accesses the associated shared object.

  • The thread releases its lock on the mutex.

When a mutex is locked, if another thread tries to also acquire a lock on it, this second thread is stalled until the first thread releases its lock on the mutex. This functionality provided by a mutex is exactly the semantic function intended by the Intel Advisor annotations ANNOTATE_LOCK_ACQUIRE() and ANNOTATE_LOCK_RELEASE().

With Intel TBB, the annotation lock address becomes the mutex object. The ANNOTATE_LOCK_ACQUIRE() and ANNOTATE_LOCK_RELEASE() annotations become operations on this mutex.

Intel TBB provides several classes for locking, each with different properties. For more information, refer to the Intel TBB documentation. If you are not sure what type of a mutex is most appropriate, consider using tbb::mutex as your initial choice.