# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CTaskManager Class Reference

CTaskManager is a class that manage a list of Task with one Thread. More...

#include <task_manager.h>

Inheritance diagram for NLMISC::CTaskManager:

NLMISC::IRunnable NLMISC::CAsyncFileManager List of all members.

Public Methods

 CTaskManager ()
 Constructor. More...

 ~CTaskManager ()
 Destructeur. More...

void run (void)
 Manage TaskQueue. More...

void addTask (IRunnable *)
 Add a task to TaskManager. More...

bool deleteTask (IRunnable *r)
 Delete a task, only if task is not running, return true if found and deleted. More...

void sleepTask (void)
 Sleep a Task. More...

uint taskListSize (void)
 Task list size. More...

bool isThreadRunning ()
 return false if exit() is required. task added with addTask() should test this flag. More...


Protected Methods

void waitCurrentTaskToComplete ()
 If any, wait the current running task to complete this function MUST be called in a 'accessor to the _TaskQueue' statement because a mutex is required eg: \begincode { CSynchronized<list<IRunnable *> >CAccessor acces(&_TaskQueue); waitCurrentTaskToComplete(); } . More...


Protected Attributes

CSynchronized< std::list<
IRunnable * > > 
_TaskQueue
 queue of tasks, using list container instead of queue for DeleteTask methode. More...

IThread_Thread
 thread pointer. More...

volatile bool _ThreadRunning
 flag indicate thread loop, if false cause thread exit. More...


Private Attributes

volatile bool _IsTaskRunning

Detailed Description

CTaskManager is a class that manage a list of Task with one Thread.

Author:
Alain Saffray , Nevrax France
Date:
2000

Definition at line 45 of file task_manager.h.


Constructor & Destructor Documentation

NLMISC::CTaskManager::CTaskManager  
 

Constructor.

Definition at line 37 of file task_manager.cpp.

References _IsTaskRunning, _Thread, and _ThreadRunning.

NLMISC::CTaskManager::~CTaskManager  
 

Destructeur.

Definition at line 48 of file task_manager.cpp.

References _ThreadRunning, and NLMISC::nlSleep.


Member Function Documentation

void NLMISC::CTaskManager::addTask IRunnable  
 

Add a task to TaskManager.

Definition at line 88 of file task_manager.cpp.

References _TaskQueue, and r.

Referenced by NLMISC::CAsyncFileManager::addLoadTask, NLMISC::CAsyncFileManager::loadFile, NLMISC::CAsyncFileManager::loadFiles, and NLMISC::CAsyncFileManager::signal.

bool NLMISC::CTaskManager::deleteTask IRunnable   r
 

Delete a task, only if task is not running, return true if found and deleted.

Definition at line 95 of file task_manager.cpp.

References _TaskQueue, and r.

bool NLMISC::CTaskManager::isThreadRunning   [inline]
 

return false if exit() is required. task added with addTask() should test this flag.

Definition at line 71 of file task_manager.h.

References _ThreadRunning.

void NLMISC::CTaskManager::run void    [virtual]
 

Manage TaskQueue.

Implements NLMISC::IRunnable.

Definition at line 56 of file task_manager.cpp.

References _IsTaskRunning, _TaskQueue, _ThreadRunning, and sleepTask.

void NLMISC::CTaskManager::sleepTask void    [inline]
 

Sleep a Task.

Definition at line 65 of file task_manager.h.

References NLMISC::nlSleep.

Referenced by run, and waitCurrentTaskToComplete.

uint NLMISC::CTaskManager::taskListSize void   
 

Task list size.

Definition at line 110 of file task_manager.cpp.

References _TaskQueue.

void NLMISC::CTaskManager::waitCurrentTaskToComplete   [protected]
 

If any, wait the current running task to complete this function MUST be called in a 'accessor to the _TaskQueue' statement because a mutex is required eg: \begincode { CSynchronized<list<IRunnable *> >CAccessor acces(&_TaskQueue); waitCurrentTaskToComplete(); } .

Definition at line 117 of file task_manager.cpp.

References sleepTask.

Referenced by NLMISC::CAsyncFileManager::cancelLoadTask.


Member Data Documentation

volatile bool NLMISC::CTaskManager::_IsTaskRunning [private]
 

Definition at line 101 of file task_manager.h.

Referenced by CTaskManager, and run.

CSynchronized<std::list<IRunnable *> > NLMISC::CTaskManager::_TaskQueue [protected]
 

queue of tasks, using list container instead of queue for DeleteTask methode.

Definition at line 91 of file task_manager.h.

Referenced by addTask, NLMISC::CAsyncFileManager::cancelLoadTask, NLMISC::CAsyncFileManager::cancelSignal, deleteTask, run, and taskListSize.

IThread* NLMISC::CTaskManager::_Thread [protected]
 

thread pointer.

Definition at line 94 of file task_manager.h.

Referenced by CTaskManager.

volatile bool NLMISC::CTaskManager::_ThreadRunning [protected]
 

flag indicate thread loop, if false cause thread exit.

Definition at line 97 of file task_manager.h.

Referenced by CTaskManager, isThreadRunning, run, and ~CTaskManager.


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