| TerraLib 4.1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Types | Static Protected Member Functions | Protected Attributes
TeThreadJobsManager Class Reference
Multi-programming tools.

A class to control the execution of concurrent jobs using spawned threads. More...

`#include <TeThreadJobsManager.h>`

List of all members.

## Classes

struct | InternalManagerDataStruct

## Public Types

enum | JobStatus { JobRunning, JobAwaiting, JobNotRunning }

## Public Member Functions

| TeThreadJobsManager ()
| ~TeThreadJobsManager ()
TeThreadJob const * | executeJob (const TeThreadJob &job)
| Add a job to the waiting jobs list to be executed when a thread becomes available or execute the job if the maximum number of simultâneous jobs is set to zero.
void | setMaxSimulJobs (unsigned long int maxSimulJobs)
void | setAutoMaxSimulJobs ()
unsigned long int | getMaxSimulJobs () const
TeThreadSignal & | getJobFinishedSignal ()
| A reference to a signal that will be emitted on each job completion.
JobStatus | getJobStatus (TeThreadJob const *const jobId)
| Return a job status.
unsigned long int | getRunningJobsNumber ()
| Return number of running jobs.
unsigned long int | getAwaitingJobsNumber ()
| Return number of awaiting jobs.
void | waitAllToFinish ()
| Wait all jobs to finish.
void | clearAwaitingJobs ()
| Clear all waiting jobs (not executed yet).

## Protected Types

typedef std::list< TeThreadJob * > | JobsListT

## Static Protected Member Functions

static bool | threadFunction (void *parsPtr)
| Entry point for all threads.

## Protected Attributes

InternalManagerDataStruct | managerData_

## Detailed Description

A class to control the execution of concurrent jobs using spawned threads.

Author:
  Emiliano F. Castejon <castejon@dpi.inpe.br>

## Member Typedef Documentation

typedef std::list< TeThreadJob* > TeThreadJobsManager::JobsListT`[protected]`

Jobs list type definition

## Member Enumeration Documentation

enum TeThreadJobsManager::JobStatus

Job status

Enumerator:

  JobRunning |
  JobAwaiting |
  JobNotRunning |

## Constructor & Destructor Documentation

TeThreadJobsManager::TeThreadJobsManager | ( |  | ) |

TeThreadJobsManager::~TeThreadJobsManager | ( |  | ) |

## Member Function Documentation

void TeThreadJobsManager::clearAwaitingJobs | ( |  | ) |

Clear all waiting jobs (not executed yet).

TeThreadJob const * TeThreadJobsManager::executeJob | ( | const TeThreadJob & | job | ) |

Add a job to the waiting jobs list to be executed when a thread becomes available or execute the job if the maximum number of simultâneous jobs is set to zero.

Parameters:

  job | Job to be processed.

Returns:
  A unique job ID as an intenal address for the added job.

unsigned long int TeThreadJobsManager::getAwaitingJobsNumber | ( |  | ) |

Return number of awaiting jobs.

Returns:
  The number of awaiting jobs.

TeThreadSignal & TeThreadJobsManager::getJobFinishedSignal | ( |  | ) |

A reference to a signal that will be emitted on each job completion.

Returns:
  A reference to a signal that will be emitted on each job completion.

TeThreadJobsManager::JobStatus TeThreadJobsManager::getJobStatus | ( | TeThreadJob const *const | jobId | ) |

Return a job status.

Parameters:

  jobId | Job ID.

Returns:
  The job status.

unsigned long int TeThreadJobsManager::getMaxSimulJobs | ( |  | ) | const

Get the number of jobs that can be executed simultaneously.

Returns:
  The number of jobs that can be executed simultaneously.

unsigned long int TeThreadJobsManager::getRunningJobsNumber | ( |  | ) |

Return number of running jobs.

Returns:
  The number of running jobs.

void TeThreadJobsManager::setAutoMaxSimulJobs | ( |  | ) |

Set the number of jobs that can be executed simultaneously using the number of physical processing units (this is the class default).

void TeThreadJobsManager::setMaxSimulJobs | ( | unsigned long int | maxSimulJobs | ) |

Set the number of threaded jobs that can be executed simultaneously.

Parameters:

  maxSimulJobs | The number of jobs that can be executed simultaneously (if set to zero, no thread will be spawned and the job execution will block the current process until it finishes).

bool TeThreadJobsManager::threadFunction | ( | void * | parsPtr | ) | `[static, protected]`

Entry point for all threads.

Parameters:

  parsPtr | Parameters pointer.

Returns:
  true if OK.

void TeThreadJobsManager::waitAllToFinish | ( |  | ) |

Wait all jobs to finish.

## Member Data Documentation

InternalManagerDataStruct TeThreadJobsManager::managerData_`[protected]`

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeThreadJobsManager.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeThreadJobsManager.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines