2
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3
* http://www.gnu.org/licenses/lgpl-3.0.html
6
#ifndef CBTHREADEDTASK_H
7
#define CBTHREADEDTASK_H
9
/// This is what you have to use instead of wxThread to add tasks to the Thread Pool.
10
/// It has a reduced, but similar, interface like that of wxThread.
11
/// Just be sure to override Execute (like wxThread's Entry) and test every now and then
16
/// cbThreadedTask ctor
19
/// cbThreadedTask dtor
20
virtual ~cbThreadedTask() = 0;
22
/// This function is called to tell the task to abort (check cbThreadPool::AbortAllTasks)
25
/// Override this function with the task's job
26
/// Return value doesn't matter
27
virtual int Execute() = 0;
30
/// Be sure to call this function often. If it returns true, quit your task quickly
31
bool TestDestroy() const;
33
/// Same as TestDestroy()
40
/* ************************************************ */
41
/* **************** INLINE MEMBERS **************** */
42
/* ************************************************ */
44
inline cbThreadedTask::cbThreadedTask()
50
inline cbThreadedTask::~cbThreadedTask()
55
inline bool cbThreadedTask::TestDestroy() const
60
inline bool cbThreadedTask::Aborted() const
65
inline void cbThreadedTask::Abort()