Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

PagePool Class Reference

#include <PagePool.h>

List of all members.


Detailed Description

Thread-safe page pool.


Public Member Functions

 PagePool (unsigned int page_size, unsigned int capacity, bool locked=true)
 Allocates capacity page-aligned blocks, each page_size bytes long, all locked into main memory (if locked).
 ~PagePool ()
 Destructor.
void * alloc ()
 Allocates and returns a single page.
void free (void *)
 Frees a page.
unsigned int page_size () const
 Returns the page size for the pool (i.e., the page_size argument to the constructor).
unsigned int capacity () const
 Returns the pool capacity (i.e., the capacity argument to the constructor).
unsigned int alloced_pages () const
 Returns the number of pages currently allocated.
unsigned int free_pages () const
 Returns the number of pages currently free.
void dump () const
 Dumps some state to stderr.
void dumpNoFreeList () const


Constructor & Destructor Documentation

PagePool::PagePool unsigned int  page_size,
unsigned int  capacity,
bool  locked = true
 

Allocates capacity page-aligned blocks, each page_size bytes long, all locked into main memory (if locked).

(One great big memalign call!) Throws an exception if unable to allocate and lock all that memory.

page_size should generally be a power of two and multiple of the system page size.

PagePool::~PagePool  ) 
 

Destructor.


Member Function Documentation

void * PagePool::alloc  ) 
 

Allocates and returns a single page.

Throws an exception if there are no free blocks left.

unsigned int PagePool::alloced_pages  )  const
 

Returns the number of pages currently allocated.

unsigned int PagePool::capacity  )  const
 

Returns the pool capacity (i.e., the capacity argument to the constructor).

void PagePool::dump  )  const
 

Dumps some state to stderr.

void PagePool::dumpNoFreeList  )  const
 

void PagePool::free void *   ) 
 

Frees a page.

unsigned int PagePool::free_pages  )  const
 

Returns the number of pages currently free.

unsigned int PagePool::page_size  )  const
 

Returns the page size for the pool (i.e., the page_size argument to the constructor).


The documentation for this class was generated from the following files:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8