| 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/TeThreadSignal.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 *************************************************************************************/
    00029 #ifndef TETHREADSIGNAL_H
    00030   #define TETHREADSIGNAL_H
    00031
    00032   #include "TeDefines.h"
    00033
    00034   #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
    00035     #include <windows.h>
    00036     #include "TeMutex.h"
    00037 #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX || TePLATFORM == TePLATFORMCODE_APPLE
    00038     #include <pthread.h>
    00039     #include  <errno.h>
    00040   #else
    00041     #error "ERROR: Unsupported platform"
    00042   #endif
    00043
    00049   class TL_DLL TeThreadSignal
    00050   {
    00051     public :
    00052
    00056       TeThreadSignal();
    00057
    00061       ~TeThreadSignal();
    00062
    00066       void emitSignal();
    00067
    00075       bool waitSignal( unsigned int waiting_time = 0 );
    00076
    00077     protected :
    00078
    00079       #if TePLATFORM == TePLATFORMCODE_MSWINDOWS
    00080
    00084         volatile int waiters_count_;
    00085
    00089         TeMutex waiters_count_lock_;
    00090
    00095         volatile int release_count_;
    00096
    00102         volatile int wait_generation_count_;
    00103
    00108         HANDLE event_;
    00109
    00110                                  #elif TePLATFORM == TePLATFORMCODE_LINUX || TePLATFORM == TePLATFORMCODE_AIX || TePLATFORM == TePLATFORMCODE_APPLE
    00111
    00115         pthread_mutex_t m_access_;
    00116
    00120         pthread_cond_t condition_var_;
    00121
    00122
    00123       #else
    00124         #error "Unsuported plataform"
    00125       #endif
    00126
    00127     private :
    00128
    00132       TeThreadSignal(  const TeThreadSignal& ) {};
    00133
    00138       const TeThreadSignal& operator=( const TeThreadSignal& ) { return *this; };
    00139
    00140   };
    00141
    00142 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines