Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

FileListLock.h

Go to the documentation of this file.
00001 #ifndef EDG_WORKLOAD_COMMON_UTILITIES_FILELISTLOCK_H
00002 #define EDG_WORKLOAD_COMMON_UTILITIES_FILELISTLOCK_H
00003 
00004 #include <boost/thread/mutex.hpp>
00005 
00006 #include "fstreamlock.h"
00007 
00008 COMMON_NAMESPACE_BEGIN {
00009 
00010 namespace utilities {
00011 
00012 class _file_sequence_t;
00013 class FileListLock;
00014 
00015 class FileListDescriptorMutex {
00016   friend class FileListLock;
00017 
00018 public:
00019   FileListDescriptorMutex( _file_sequence_t &fs );
00020 
00021   ~FileListDescriptorMutex( void );
00022 
00023 protected:
00024   bool         fldm_locked;
00025   int          fldm_descriptor;
00026 };
00027 
00028 class FileListMutex : private FileListDescriptorMutex {
00029   friend class FileListLock;
00030 
00031 public:
00032   FileListMutex( _file_sequence_t &fs );
00033 
00034   ~FileListMutex( void );
00035 
00036 private:
00037   boost::mutex   flm_mutex;
00038 };
00039 
00040 class FileListLock {
00041 public:
00042   FileListLock( FileListDescriptorMutex &fldm, bool lock = true );
00043   FileListLock( FileListMutex &flm, bool lock = true );
00044 
00045   ~FileListLock( void );
00046 
00047   int lock( void );
00048   int unlock( void );
00049 
00050 private:
00051   bool                       *fl_locked;
00052   boost::mutex::scoped_lock  *fl_mutexlock;
00053   DescriptorLock              fl_filelock;
00054 };
00055 
00056 }; // Namespace utilities
00057 
00058 } COMMON_NAMESPACE_END;
00059 
00060 #endif /* EDG_WORKLOAD_COMMON_UTILITIES_FILELISTLOCK_H */
00061 
00062 // Local Variables:
00063 // mode: c++
00064 // End:

Generated on Wed Mar 1 00:37:54 2006 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen 1.3.5