#include <ace/MEM_SAP.h>
class ACE_MEM_SAP {
public:
typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> MALLOC_TYPE; typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block> MALLOC_TYPE;typedef ACE_MMAP_Memory_Pool_Options MALLOC_OPTIONS;
~ACE_MEM_SAP (void);
void *acquire_buffer (const ssize_t size);
int release_buffer (void *buf);
off_t set_buf_len (void *buf, size_t n);
ssize_t get_buf_len (const off_t off, void *&buf);
int remove (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
protected:
int create_shm_malloc (LPCTSTR name, MALLOC_OPTIONS *options = 0);
int close_shm_malloc (const int remove = 0);
MALLOC_TYPE *shm_malloc_;
ACE_MEM_SAP (void);
};
typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> MALLOC_TYPE;
typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_Control_Block> MALLOC_TYPE;
typedef ACE_MMAP_Memory_Pool_Options MALLOC_OPTIONS;
~ACE_MEM_SAP (void);
void *acquire_buffer (const ssize_t size);
size
. Return 0 if the shm_malloc_
is
not initialized.
int release_buffer (void *buf);
buf
. Return -1 if the shm_malloc_
is not initialized.
off_t set_buf_len (void *buf, size_t n);
n
bytes.
Return the offset of the buf
relative to the base address.
buf
must be acquired by get_buffer
method. Return -1 if the
shm_malloc_
is not initialized.
ssize_t get_buf_len (const off_t off, void *&buf);
off
to absolute address to buf
.
Return the size of valid information containing in the buf
,
-1 if shm_malloc_
is not initialized.
int remove (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
int create_shm_malloc (LPCTSTR name, MALLOC_OPTIONS *options = 0);
int close_shm_malloc (const int remove = 0);
remove
!= 0, then the
mmap file will also get removed.
MALLOC_TYPE *shm_malloc_;
ACE_MEM_SAP (void);
nanbor@cs.wustl.edu