Skip to content
Snippets Groups Projects
Commit 5b17b339 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Add LockedHandle class, that locks/unlocks access around ptr

usage:
```c++
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:

```c++
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

See merge request !195
parents b5e05a18 84f538d4
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment