00001 /********************************************************************** 00002 * File: memsem.hh 00003 * Purpose: Provides function prototypes that let programmers 00004 * use a block of memory to implement a mutual exclusion semaphore. 00005 * 00006 * With LynxOs and SunOs using semop is very inefficient if the semaphore will 00007 * ussually be available. Other platforms may give you no semaphore operations. 00008 *************************************************************************/ 00009 00010 00011 #ifndef MEMSEM_HH 00012 #define MEMSEM_HH 00013 00014 #include "sem.hh" 00015 00016 /* Take the mutual exclusion semaphore. */ 00017 struct mem_access_object 00018 { 00019 void *data; 00020 long connection_number; 00021 long total_connections; 00022 double timeout; 00023 double sem_delay; 00024 int read_only; 00025 int split_buffer; 00026 char toggle_bit; 00027 RCS_SEMAPHORE *sem; 00028 }; 00029 00030 00031 extern int mem_get_access (struct mem_access_object *mo); 00032 00033 00034 /* Give up the mutual exclusion semaphore. */ 00035 extern int mem_release_access (struct mem_access_object *mo); 00036 00037 #endif