A guard that protects resources of a given class from being detroyed if another thread still works with them.
More...
A guard that protects resources of a given class from being detroyed if another thread still works with them.
One might think this is not necessary, there is std::shared_ptr for it. But - for objects that don't have shared ownership which are out of control regarding construction/destruction (think of MeVisLab modules controlled by MeVisLab), you need to make sure that MeVisLab doesn't destroys your object while threads are working with it.
Synopsis:
{
private:
{
auto handle = guard.handle();
std::thread([handle] {
auto lock = handle.lock();
if (lock) {
}
else {
}
});
}
};
A guard that protects resources of a given class from being detroyed if another thread still works wi...
Base class for an image processing module of the ML.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
Definition at line 67 of file ResourceDestructionGuard.h.