memsem.hh
1 /******************************************************************** 2 * Description: memsem.hh 3 * Provides function prototypes that let programmers use a block of 4 * memory to implement a mutual exclusion semaphore. 5 * 6 * Derived from a work by Fred Proctor & Will Shackleford 7 * 8 * Author: 9 * License: LGPL Version 2 10 * System: Linux 11 * 12 * Copyright (c) 2004 All rights reserved. 13 * 14 * Last change: 15 ********************************************************************/ 16 17 #ifndef MEMSEM_HH 18 #define MEMSEM_HH 19 20 #include "sem.hh" 21 22 /* Take the mutual exclusion semaphore. */ 23 struct mem_access_object { 24 void *data; 25 long connection_number; 26 long total_connections; 27 double timeout; 28 double sem_delay; 29 int read_only; 30 int split_buffer; 31 char toggle_bit; 32 RCS_SEMAPHORE *sem; 33 }; 34 35 extern int mem_get_access(struct mem_access_object *mo); 36 37 /* Give up the mutual exclusion semaphore. */ 38 extern int mem_release_access(struct mem_access_object *mo); 39 40 #endif