Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

sem.hh

Go to the documentation of this file.
00001 
00002 #ifndef SEMAPHORE_HH
00003 #define SEMAPHORE_HH
00004 
00005 extern "C"
00006 {
00007 #include "_sem.h"               /* rcs_sem_t */
00008 #ifndef UNDER_CE
00009 #include <sys/stat.h>           /* S_IRUSR, etc. */
00010 #endif
00011 }
00012 /* rw-rw-rw- permissions */
00013 #ifndef WIN32
00014 #define DEFAULT_SEM_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
00015 #else
00016 #define DEFAULT_SEM_MODE (0)
00017 #endif
00018 
00019 #define RCS_SEMAPHORE_NOCREATE 0x00     /* just attach to existing semaphore */
00020 #define RCS_SEMAPHORE_CREATE 0x01       /* create semaphore */
00021 
00022 class RCS_SEMAPHORE
00023 {
00024 public:
00025   RCS_SEMAPHORE (unsigned long int id, int oflag, double _timeout,
00026                  int mode = DEFAULT_SEM_MODE, int state = 0);
00027    ~RCS_SEMAPHORE ();
00028   int wait ();
00029   int trywait ();
00030   int post ();
00031   int flush ();
00032   int getvalue ();
00033   /* additional non-POSIX functions */
00034   int setflag (int oflag);      /* change oflag-- one can toggle the
00035                                    state of this being the master, so
00036                                    that flexible destruction of OS
00037                                    semaphore can be done */
00038   int valid ();
00039   int clear ();                 // Make sure this semaphore will not
00040   // immediately be available.
00041 
00042   unsigned long int id;
00043   double timeout;
00044   int oflag;
00045   int mode;
00046   int state;
00047   rcs_sem_t *sem;
00048   unsigned int sval;
00049 
00050 private:
00051     RCS_SEMAPHORE (RCS_SEMAPHORE & sem);        //  Don't copy me.
00052 
00053 };
00054 
00055 #endif

Generated on Sun Dec 2 15:56:52 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001