00001 /*************************************************************************** 00002 LOW_semaphoreSetSysV.h - description 00003 ------------------- 00004 begin : Mon Jul 29 2002 00005 copyright : (C) 2002 by Harald Roelle, Helmut Reiser 00006 email : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef LOW_SEMAPHORESET_SYSV_H 00019 #define LOW_SEMAPHORESET_SYSV_H 00020 00021 00022 #include "LOW_semaphoreSet.h" 00023 #include "LOW_semaphoreSetFactory.h" 00024 00025 00026 00027 /** Platform specific semaphoreSet for Unix System V platforms. 00028 00029 @author Harald Roelle, Helmut Reiser 00030 */ 00031 class LOW_semaphoreSet_SysV : public LOW_semaphoreSet { 00032 00033 //======================================================================================= 00034 public: 00035 00036 //===================================================================================== 00037 // 00038 // constructors 00039 // 00040 00041 /** Constructor. 00042 00043 @param inSemSetIPCKey Unique identifier for new shared memory segment. 00044 To get such an identifier see LOW_IPCKeyGenerator. 00045 @param inSemCount Number of semaphores in set. 00046 @param inInitVal Initial values of semaphores. 00047 */ 00048 LOW_semaphoreSet_SysV( const LOW_semaphoreSetFactory::semSetIPCKey_t inKey, 00049 const unsigned int inSemCount, const unsigned int inInitVal); 00050 00051 /** Destructor. 00052 */ 00053 virtual ~LOW_semaphoreSet_SysV(); 00054 00055 00056 //===================================================================================== 00057 // 00058 // methods 00059 // 00060 00061 void decSem( const unsigned int inSemNo) const; 00062 00063 void incSem( const unsigned int inSemNo) const; 00064 00065 00066 //======================================================================================= 00067 private: 00068 00069 //===================================================================================== 00070 // 00071 // constants 00072 // 00073 00074 static const int SEM_PERMS = 0770; /**< Permissions for the semaphore set. */ 00075 00076 00077 //===================================================================================== 00078 // 00079 // attributes 00080 // 00081 00082 const key_t semSetKey; /**< IPC key of the segment. */ 00083 int semSetID; /**< Sys V segment ID. */ 00084 00085 }; 00086 00087 #endif