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.
void purge (void)
 Purge the memory pool while locked.
void * first (size_t size)
 Get the first memory page after locking.
void * alloc (size_t size)
 Get the last memory page after locking.
- 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.
char * alloc (const char *str)
 Allocate a string from the memory pager pool and copy the string inti it's new memory area.
 MemPager (size_t pagesize=4096)
 Create a paged memory pool for cumulative storage.
void clean (void)
 Clean for memory cleanup before exiting.
virtual ~MemPager ()
 Delete the memory pool and all allocated memory.

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.
- Public Member Functions inherited from ost::Mutex
 Mutex (const char *name=NULL)
 The mutex is always initialized as a recursive entity.
virtual ~Mutex ()
 Destroying the mutex removes any system resources associated with it.
void nameMutex (const char *name)
 Enable setting of mutex name for deadlock debug.
void enterMutex (void)
 Entering a Mutex locks the mutex for the current thread.
void enter (void)
 Future abi will use enter/leave/test members.
void leave (void)
 Future abi will use enter/leave/test members.
bool test (void)
 Future abi will use enter/leave/test members.
bool tryEnterMutex (void)
 Tries to lock the mutex for the current thread.
void leaveMutex (void)
 Leaving a mutex frees that mutex for use by another thread.
- Static Public Member Functions inherited from ost::Mutex
static void setDebug (bool mode)
 Enable or disable deadlock debugging.

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.

Reimplemented from ost::MemPager.


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