GNU CommonC++
Protected Member Functions | List of all members
ost::SharedMemPager Class Reference

The shared mempager uses a mutex to protect key access methods. More...

#include <misc.h>

Inheritance diagram for ost::SharedMemPager:
ost::MemPager ost::Mutex

Protected Member Functions

 SharedMemPager (size_t pagesize=4096, const char *name=NULL)
 Create a mempager mutex pool. More...
 
void purge (void)
 Purge the memory pool while locked. More...
 
void * first (size_t size)
 Get the first memory page after locking. More...
 
void * alloc (size_t size)
 Get the last memory page after locking. More...
 
- Protected Member Functions inherited from ost::MemPager
char * first (char *str)
 Allocate a string from the memory pager pool and copy the string into it's new memory area. More...
 
char * alloc (const char *str)
 Allocate a string from the memory pager pool and copy the string inti it's new memory area. More...
 
 MemPager (size_t pagesize=4096)
 Create a paged memory pool for cumulative storage. More...
 
void purge (void)
 purge the current memory pool. More...
 
void clean (void)
 Clean for memory cleanup before exiting. More...
 
virtual ~MemPager ()
 Delete the memory pool and all allocated memory. More...
 

Additional Inherited Members

- Public Member Functions inherited from ost::MemPager
int getPages (void)
 Return the total number of pages that have been allocated for this memory pool. More...
 
- Public Member Functions inherited from ost::Mutex
 Mutex (const char *name=NULL)
 The mutex is always initialized as a recursive entity. More...
 
virtual ~Mutex ()
 Destroying the mutex removes any system resources associated with it. More...
 
void nameMutex (const char *name)
 Enable setting of mutex name for deadlock debug. More...
 
void enterMutex (void)
 Entering a Mutex locks the mutex for the current thread. More...
 
void enter (void)
 Future abi will use enter/leave/test members. More...
 
void leave (void)
 Future abi will use enter/leave/test members. More...
 
bool test (void)
 Future abi will use enter/leave/test members. More...
 
bool tryEnterMutex (void)
 Tries to lock the mutex for the current thread. More...
 
void leaveMutex (void)
 Leaving a mutex frees that mutex for use by another thread. More...
 
- Static Public Member Functions inherited from ost::Mutex
static void setDebug (bool mode)
 Enable or disable deadlock debugging. More...
 

Detailed Description

The shared mempager uses a mutex to protect key access methods.

This class is used when a mempager will be shared by multiple threads.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m mutex protected memory pager.

Constructor & Destructor Documentation

ost::SharedMemPager::SharedMemPager ( size_t  pagesize = 4096,
const char *  name = NULL 
)
protected

Create a mempager mutex pool.

Parameters
pagesizepage size for allocation.
namea name for the pool.

Member Function Documentation

void* ost::SharedMemPager::alloc ( size_t  size)
protectedvirtual

Get the last memory page after locking.

Returns
allocated memory space.
Parameters
sizeof request.

Reimplemented from ost::MemPager.

void* ost::SharedMemPager::first ( size_t  size)
protectedvirtual

Get the first memory page after locking.

Returns
allocated memory space.
Parameters
sizeof request.

Reimplemented from ost::MemPager.

void ost::SharedMemPager::purge ( void  )
protected

Purge the memory pool while locked.


The documentation for this class was generated from the following file: