Skip to content

GMR-195: add GaudiKernel/LockedHandle class

Charles Leggett requested to merge leggett/AtlasGaudi:dev/GMR-195 into atlas/v27r2

apply Gaudi Merge Request 195: gaudi/Gaudi!195 (merged)

Added GaudiKernel/LockedHandle class, that surrounds accesses to owned ptr via a mutex lock/unlock.

usage:

std::mutex the_mutex; Obj *o = new Obj(); LockedHandle lh(o, &the_mutex); o->doSomething();

access to o->doSomething() will be protected by a mutex.

uses a std::mutex by default, but this can be overrided via a second template arg:

LockedHandle<Obj_TYPE, Mutex_TYPE>

CPPUnit test is also provided

modified: GaudiKernel/CMakeLists.txt new file: GaudiKernel/GaudiKernel/LockedHandle.h new file: GaudiKernel/tests/src/test_LockedHandle.cpp

Merge request reports