Add LockedHandle class, that locks/unlocks access around ptr
a mutex lock/unlock.
usage:
std::mutex the_mutex;
Obj *o = new Obj();
LockedHandle<Obj> 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 overridden via a second
template arg:
LockedHandle<Obj_TYPE, Mutex_TYPE> lh(obj, &mut);
CPPUnit test is also provided
modified: GaudiKernel/CMakeLists.txt
new file: GaudiKernel/GaudiKernel/LockedHandle.h
new file: GaudiKernel/tests/src/test_LockedHandle.cpp