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

_sem.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef _RCS_SEMAPHORE_H
00004 #define _RCS_SEMAPHORE_H
00005 
00006 #include "rcs_defs.hh"
00007 #if  defined(WIN32)
00008 
00009 #if defined(WIN32) && !defined(USE_OLD_WINSOCK)
00010 /* Lame problem if windows.h is included before winsock2.h many redefined
00011  compiler errors result. */
00012 #include <winsock2.h>
00013 #endif
00014 
00015 #include <windows.h>
00016 #endif
00017 
00018 
00019 #if defined VXWORKS
00020 
00021 #include <semLib.h>             /* SEM_ID */
00022 
00023 typedef struct
00024 {
00025   /* Modified  4-May-1998 by WPS, match VxWorks calls and make variable names clearer. */
00026   /* unsigned long int id; */
00027   /*  struct semaphore *sem; */
00028   unsigned long int key;
00029   SEM_ID sem_id;
00030 }
00031 rcs_sem_t;
00032 
00033 #else /* Unix */
00034 
00035 #if defined(darwin) || defined(qnx)
00036 #define POSIX_SEMAPHORES
00037 
00038 #include <semaphore.h>
00039 
00040 typedef struct rcs_sem_t_struct
00041 {
00042   sem_t *sem;
00043   char name[32];
00044   int key;
00045 }
00046 rcs_sem_t;
00047 
00048 
00049 #else
00050 #if defined(WIN32)
00051 
00052 typedef struct
00053 {
00054   char name[64];
00055   unsigned long int id;
00056   HANDLE handle;
00057 }
00058 rcs_sem_t;
00059 
00060 #else
00061 
00062 typedef int rcs_sem_t;          /* make it an int */
00063 #endif
00064 #endif
00065 
00066 #endif
00067 
00068 #ifdef __cplusplus
00069 extern "C"
00070 {
00071 #endif
00072 
00073 
00074 #ifdef VXWORKS
00075   void rcs_sem_table_print ();
00076 
00077   extern int rcs_sem_table_inited;
00078   extern int print_rcs_sem_warnings;
00079 
00080 #endif
00081 
00082   int rcs_sem_init (rcs_sem_t * sem, int pshared, unsigned int value);
00083   int rcs_sem_destroy (rcs_sem_t * sem);
00084   rcs_sem_t *rcs_sem_open (const char *name, int oflag, /*, int mode */ ...);
00085   int rcs_sem_close (rcs_sem_t * sem);
00086   int rcs_sem_unlink (const char *name);
00087   int rcs_sem_wait (rcs_sem_t * sem, double timeout);
00088   int rcs_sem_trywait (rcs_sem_t * sem);
00089   int rcs_sem_flush (rcs_sem_t * sem);
00090   int rcs_sem_post (rcs_sem_t * sem);
00091   int rcs_sem_getvalue (rcs_sem_t * sem, unsigned int *sval);
00092   int rcs_sem_clear (rcs_sem_t * sem);
00093 
00094 /* additions */
00095   rcs_sem_t *rcs_sem_create (unsigned long int id, int mode, int state);
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 
00100 #if !defined(VXWORKS) && !defined(WIN32)
00101 extern int sem_force_fifo;
00102 #endif
00103 
00104 #endif

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