Last change
on this file was 367, checked in by RBRi, 16 years ago |
format updates
|
-
Property svn:eol-style
set to
native
|
File size:
1.5 KB
|
Rev | Line | |
---|
[26] | 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 |
|
---|
[360] | 9 | typedef struct
|
---|
[26] | 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 |
|
---|
[360] | 27 | typedef struct
|
---|
[26] | 28 | {
|
---|
| 29 | TSharedMemory FMem;
|
---|
[360] | 30 | void* FAllocationArea;
|
---|
[26] | 31 | } TSubAllocatedSharedMemory;
|
---|
| 32 |
|
---|
| 33 | APIRET GetSubAllocatedSharedMemory( char* Name,
|
---|
| 34 | ULONG Size,
|
---|
| 35 | ULONG ReserveSize, // size to reserve at start of memory
|
---|
[360] | 36 | TSubAllocatedSharedMemory* pSharedMemory );
|
---|
[26] | 37 |
|
---|
[367] | 38 |
|
---|
[26] | 39 | // suballocate space of the given size
|
---|
| 40 | APIRET SubAllocate( TSubAllocatedSharedMemory* pSharedMemory,
|
---|
| 41 | ULONG Size,
|
---|
| 42 | void** p );
|
---|
| 43 |
|
---|
[367] | 44 |
|
---|
[26] | 45 | // free the given space.
|
---|
| 46 | void SubDeAllocate( TSubAllocatedSharedMemory* pSharedMemory,
|
---|
| 47 | void** p );
|
---|
| 48 |
|
---|
[367] | 49 |
|
---|
[26] | 50 | void ReleaseSubAllocatedSharedMemory( TSubAllocatedSharedMemory* pSharedMemory );
|
---|
| 51 |
|
---|
| 52 |
|
---|
[367] | 53 | APIRET OpenOrCreateMutex( PSZ pszName, PHMTX phmtx );
|
---|
| 54 |
|
---|
| 55 |
|
---|
[26] | 56 | #endif
|
---|
[360] | 57 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.