| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeThreadJobsManager.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright  2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00023
    00024
    00025 #ifndef __TERRALIB_INTERNAL_TETRHEADJOBSMANAGER_H
    00026 #define __TERRALIB_INTERNAL_TETRHEADJOBSMANAGER_H
    00027
    00028 #include "TeThreadJob.h"
    00029 #include "TeThreadSignal.h"
    00030 #include "TeMutex.h"
    00031 #include "TeDefines.h"
    00032
    00033 #include <list>
    00034
    00035 class TeThreadFunctor;
    00036
    00042 class TL_DLL TeThreadJobsManager
    00043 {
    00044   public :
    00046     enum JobStatus { JobRunning, JobAwaiting, JobNotRunning };
    00047
    00048     TeThreadJobsManager();
    00049
    00050     ~TeThreadJobsManager();
    00051
    00059     TeThreadJob const* executeJob( const TeThreadJob& job );
    00060
    00066     void setMaxSimulJobs( unsigned long int maxSimulJobs );
    00067
    00071     void setAutoMaxSimulJobs();
    00072
    00076     unsigned long int getMaxSimulJobs() const;
    00077
    00083     TeThreadSignal& getJobFinishedSignal();
    00084
    00089     JobStatus getJobStatus( TeThreadJob const* const jobId );
    00090
    00094     unsigned long int getRunningJobsNumber();
    00095
    00099     unsigned long int getAwaitingJobsNumber();
    00100
    00103     void waitAllToFinish();
    00104
    00107     void clearAwaitingJobs();
    00108
    00109   protected :
    00110
    00112     typedef std::list< TeThreadJob* > JobsListT;
    00113
    00114     struct InternalManagerDataStruct
    00115     {
    00117       unsigned long int maxSimulJobs_;
    00118
    00120       TeThreadSignal jobFinishedSig_;
    00121
    00123       JobsListT awaitingJobsList_;
    00124
    00126       JobsListT runningJobsList_;
    00127
    00129       std::list< TeThreadFunctor* > threadsList_;
    00130
    00132       TeMutex mutex_;
    00133     };
    00134
    00135     InternalManagerDataStruct managerData_;
    00136
    00141     static bool threadFunction( void* parsPtr );
    00142
    00143 };
    00144
    00145 #endif
    00146

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines