13 #ifndef mitkStorageThreadDispatcherBase_h
14 #define mitkStorageThreadDispatcherBase_h
18 #include <itkObject.h>
48 if (this->IsDispatchThread())
54 this->ExecuteDispatched(task);
83 virtual void Post(std::function<
void()> task) = 0;
96 this->Execute([&result, &task]() { result = task(); });
Abstract base class for dispatching tasks to the thread that owns DataStorage.
virtual void ExecuteDispatched(std::function< void()> task)=0
Execute a task on the storage-owning thread, blocking until completion.
void Execute(std::function< void()> task)
Execute a task on the storage-owning thread, blocking until completion.
R ExecuteWithResult(std::function< R()> task)
Convenience template for tasks that return a value.
~StorageThreadDispatcherBase() override=default
virtual bool IsDispatchThread() const =0
Check if the current thread is the dispatch target thread.
StorageThreadDispatcherBase()=default
virtual void Post(std::function< void()> task)=0
Post a task to run on the storage-owning thread, returning immediately.
mitkClassMacroItkParent(StorageThreadDispatcherBase, itk::Object)
Find image slices visible on a given plane.