omni::graph::exec::unstable::RaceConditionFinder

Defined in omni/graph/exec/unstable/RaceConditionFinder.h

Classes

  • Scope: Create scope around the fake "critical section".

class RaceConditionFinder

Helper class for detecting race conditions.

This type of a “fake lock” has been known under many names. The goal is to create a “critical section” without enforcing synchronization. If more than one thread falls into this “critical section” it means we haven’t managed (at the orchestration level) guarantee sequential execution of particular code.

The RC finder is used very similar to a lock, i.e. you allocate a shared RC finder and enter the “critical section” using Scope RAII object. When more than one thread enters this section, we will make them spin forever and issue a debug break from the first thread that started the section. This allows to catch all the threads and easily debug by seeing all the callstacks and states.

RC finder supports recursive execution.

This is a debugging object and shouldn’t be used in released product. Without debugged attached, application will simply crash. As a result, we don’t include it as part of any .cpp code coverage reports.

class Scope

Create scope around the fake “critical section”.

Public Functions

inline Scope(RaceConditionFinder &finder)

Construct the scope with a valid shared finder.

inline ~Scope()

Issue a breakpoint if race condition is detected, otherwise release the section.