Code::Blocks  SVN r11506
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
cbThreadedTask Class Referenceabstract

This is what you have to use instead of wxThread to add tasks to the Thread Pool. More...

#include <cbthreadedtask.h>

Inheritance diagram for cbThreadedTask:
Collaboration diagram for cbThreadedTask:

Public Member Functions

 cbThreadedTask ()
 cbThreadedTask ctor More...
 
virtual ~cbThreadedTask ()=0
 cbThreadedTask dtor More...
 
void Abort ()
 This function is called to tell the task to abort (check cbThreadPool::AbortAllTasks) More...
 
virtual int Execute ()=0
 Override this function with the task's job Return value doesn't matter. More...
 

Protected Member Functions

bool TestDestroy () const
 Be sure to call this function often. If it returns true, quit your task quickly. More...
 
bool Aborted () const
 Same as TestDestroy() More...
 

Private Attributes

bool m_abort
 

Detailed Description

This is what you have to use instead of wxThread to add tasks to the Thread Pool.

It has a reduced, but similar, interface like that of wxThread. Just be sure to override Execute (like wxThread's Entry) and test every now and then for TestDestroy.

Definition at line 13 of file cbthreadedtask.h.

Constructor & Destructor Documentation

◆ cbThreadedTask()

cbThreadedTask::cbThreadedTask ( )
inline

cbThreadedTask ctor

Definition at line 44 of file cbthreadedtask.h.

◆ ~cbThreadedTask()

cbThreadedTask::~cbThreadedTask ( )
inlinepure virtual

cbThreadedTask dtor

Definition at line 50 of file cbthreadedtask.h.

Member Function Documentation

◆ Abort()

void cbThreadedTask::Abort ( )
inline

This function is called to tell the task to abort (check cbThreadPool::AbortAllTasks)

Definition at line 65 of file cbthreadedtask.h.

References m_abort.

Referenced by cbThreadPool::cbWorkerThread::AbortTask().

◆ Aborted()

bool cbThreadedTask::Aborted ( ) const
inlineprotected

Same as TestDestroy()

Definition at line 60 of file cbthreadedtask.h.

References m_abort.

◆ Execute()

virtual int cbThreadedTask::Execute ( )
pure virtual

Override this function with the task's job Return value doesn't matter.

Implemented in ParserThread, MarkFileAsLocalThreadedTask, and ParserThreadedTask.

Referenced by cbThreadPool::cbWorkerThread::Entry().

◆ TestDestroy()

bool cbThreadedTask::TestDestroy ( ) const
inlineprotected

Be sure to call this function often. If it returns true, quit your task quickly.

Definition at line 55 of file cbthreadedtask.h.

References m_abort.

Referenced by ParserThread::IsStillAlive().

Member Data Documentation

◆ m_abort

bool cbThreadedTask::m_abort
private

Definition at line 37 of file cbthreadedtask.h.

Referenced by Abort(), Aborted(), and TestDestroy().


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