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

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Lang/Mutex.h

    00001 // Mutex.h
    00002
    00003 #ifndef MERS_UTILS_LANG_MUTEX_H
    00004 #define MERS_UTILS_LANG_MUTEX_H
    00005
    00006 // This class is little more than a wrapper around calls to pthread_mutex_init, pthread_mutex_destroy, pthread_mutex_lock and pthread_mutex_unlock
    00007 // Its main use is that it deals with error handling
    00008
    00009 #include "String.h"
    00010
    00011 #include <Mers/Utils/Logging/logger.h>
    00012
    00013 #include <pthread.h>
    00014
    00015 namespace Mers {
    00016         namespace Utils {
    00017                 namespace Lang {
    00018
    00019                         class Mutex
    00020                         {
    00021                         public:
    00022                                 Mutex( String _className, bool recursive = true );
    00023                                 ~Mutex( void );
    00024                                 bool LockMutex( String tag = "" );
    00025                                 bool UnlockMutex( String tag = "" );
    00026                                 pthread_mutex_t mutex ;
    00027                         private:
    00028                                 String className;
    00029                                 log4cplus::Logger logger;
    00030                                 bool InitializeMutex( bool recursive );
    00031                                 bool ReleaseMutex( void );
    00032                         };
    00033
    00034                 } // end namespace Lang
    00035         } // end namespace Utils
    00036 } // end namespace Mers
    00037
    00038 #endif