| Last change
 on this file since 417 was             367, checked in by RBRi, 16 years ago | 
        
          | 
format updates
 | 
        
          | 
              
Property                 svn:eol-style
 set to                 native | 
        
          | File size:
            1.5 KB | 
      
      
| Line |  | 
|---|
| 1 | #ifndef SHAREDMEMORY_H | 
|---|
| 2 | #define SHAREDMEMORY_H | 
|---|
| 3 |  | 
|---|
| 4 |  | 
|---|
| 5 | // Encapsulates a basic shared memory block. After creating, | 
|---|
| 6 | // the Data pointer can be used to read or write the data | 
|---|
| 7 | // in the memory. | 
|---|
| 8 |  | 
|---|
| 9 | typedef struct | 
|---|
| 10 | { | 
|---|
| 11 | void* FPointer; | 
|---|
| 12 | BOOL FFirst; // true if this object created the shared mem block | 
|---|
| 13 | } TSharedMemory; | 
|---|
| 14 |  | 
|---|
| 15 | APIRET GetSharedMemory( char* Name, | 
|---|
| 16 | ULONG Size, | 
|---|
| 17 | TSharedMemory* pSharedMemory ); | 
|---|
| 18 |  | 
|---|
| 19 | void ReleaseSharedMemory( TSharedMemory* pSharedMemory ); | 
|---|
| 20 |  | 
|---|
| 21 | // Encapsulates a shared memory block which can be suballocated | 
|---|
| 22 | // into smaller areas. | 
|---|
| 23 | // Allocate and Free are used to allocate these areas. | 
|---|
| 24 | // A space can be reserved for using as a normal shared mem block. | 
|---|
| 25 | // Otherwise the Data property should not be used. | 
|---|
| 26 |  | 
|---|
| 27 | typedef struct | 
|---|
| 28 | { | 
|---|
| 29 | TSharedMemory FMem; | 
|---|
| 30 | void* FAllocationArea; | 
|---|
| 31 | } TSubAllocatedSharedMemory; | 
|---|
| 32 |  | 
|---|
| 33 | APIRET GetSubAllocatedSharedMemory( char* Name, | 
|---|
| 34 | ULONG Size, | 
|---|
| 35 | ULONG ReserveSize, // size to reserve at start of memory | 
|---|
| 36 | TSubAllocatedSharedMemory* pSharedMemory ); | 
|---|
| 37 |  | 
|---|
| 38 |  | 
|---|
| 39 | // suballocate space of the given size | 
|---|
| 40 | APIRET SubAllocate( TSubAllocatedSharedMemory* pSharedMemory, | 
|---|
| 41 | ULONG Size, | 
|---|
| 42 | void** p ); | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | // free the given space. | 
|---|
| 46 | void SubDeAllocate( TSubAllocatedSharedMemory* pSharedMemory, | 
|---|
| 47 | void** p ); | 
|---|
| 48 |  | 
|---|
| 49 |  | 
|---|
| 50 | void ReleaseSubAllocatedSharedMemory( TSubAllocatedSharedMemory* pSharedMemory ); | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | APIRET OpenOrCreateMutex( PSZ pszName, PHMTX phmtx ); | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|
| 56 | #endif | 
|---|
| 57 |  | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.