MeVisLab Toolbox Reference
ml::BackgroundTaskHandle Class Reference

A handle to a task that has been created by the background task manager. More...

#include <mlBackgroundTaskHandle.h>

Inheritance diagram for ml::BackgroundTaskHandle:
ml::TypedBackgroundTaskHandle< Task >

Public Member Functions

 BackgroundTaskHandle ()
 
void clear ()
 Clears the handle. Make sure to call this from the taskFinishedCB of the background task manager. More...
 
bool hasTask () const
 Returns whether the handle has a task. More...
 
bool hasRunningTask () const
 Returns whether the handle has a task that is not canceled. More...
 
bool isCanceled () const
 Returns whether the task was canceled. More...
 
void cancel ()
 Cancels the running task. More...
 
void setOwnerWasDeleted ()
 Tells the task that the owner was deleted. More...
 

Protected Member Functions

 BackgroundTaskHandle (BackgroundTask *task)
 

Protected Attributes

BackgroundTask_task
 

Friends

class BackgroundTaskManager
 
class BackgroundTaskHandleAccessor
 

Detailed Description

A handle to a task that has been created by the background task manager.

This handle allows limited access to a running task to prevent users from calling methods that are not designed to be invoked while the task is being processed in a worker thread.

Definition at line 30 of file mlBackgroundTaskHandle.h.

Constructor & Destructor Documentation

◆ BackgroundTaskHandle() [1/2]

ml::BackgroundTaskHandle::BackgroundTaskHandle ( )
inline

Definition at line 33 of file mlBackgroundTaskHandle.h.

◆ BackgroundTaskHandle() [2/2]

ml::BackgroundTaskHandle::BackgroundTaskHandle ( BackgroundTask task)
inlineprotected

Definition at line 56 of file mlBackgroundTaskHandle.h.

Member Function Documentation

◆ cancel()

void ml::BackgroundTaskHandle::cancel ( )

Cancels the running task.

◆ clear()

void ml::BackgroundTaskHandle::clear ( )

Clears the handle. Make sure to call this from the taskFinishedCB of the background task manager.

◆ hasRunningTask()

bool ml::BackgroundTaskHandle::hasRunningTask ( ) const

Returns whether the handle has a task that is not canceled.

◆ hasTask()

bool ml::BackgroundTaskHandle::hasTask ( ) const

Returns whether the handle has a task.

◆ isCanceled()

bool ml::BackgroundTaskHandle::isCanceled ( ) const

Returns whether the task was canceled.

◆ setOwnerWasDeleted()

void ml::BackgroundTaskHandle::setOwnerWasDeleted ( )

Tells the task that the owner was deleted.

Friends And Related Function Documentation

◆ BackgroundTaskHandleAccessor

friend class BackgroundTaskHandleAccessor
friend

Definition at line 55 of file mlBackgroundTaskHandle.h.

◆ BackgroundTaskManager

friend class BackgroundTaskManager
friend

Definition at line 54 of file mlBackgroundTaskHandle.h.

Member Data Documentation

◆ _task

BackgroundTask* ml::BackgroundTaskHandle::_task
protected

Definition at line 58 of file mlBackgroundTaskHandle.h.

Referenced by ml::BackgroundTaskHandleAccessor::get().


The documentation for this class was generated from the following file: