Loading...
Searching...
No Matches
XrdCl::BufferPool Class Reference

Buffer pool - to limit memory consumption. More...

Collaboration diagram for XrdCl::BufferPool:

## Public Member Functions

std::shared_ptr< std::vector< char > > | Allocate (size_t length)

## Static Public Member Functions

static BufferPool & | Instance ()
| Single instance access.

## Detailed Description

Buffer pool - to limit memory consumption.

Definition at line 56 of file XrdClReplay.cc.

## Member Function Documentation

## Allocate()

std::shared_ptr< std::vector< char > > XrdCl::BufferPool::Allocate | ( | size_t | length | ) |

inline

Allocate a buffer if has available memory, otherwise wait until enough memory has been reclaimed

Definition at line 73 of file XrdClReplay.cc.

{
std::unique_lock<std::mutex> lck( mtx );
cv.wait( lck, [this, length]{ return available >= length; } );
available -= length;
BufferDeleter del;
std::shared_ptr<std::vector<char>> buffer( new std::vector<char>( length, 'A' ), del );
return buffer;
}

## Instance()

BufferPool & XrdCl::BufferPool::Instance | ( |  | ) |

inline static

Single instance access.

Definition at line 63 of file XrdClReplay.cc.

{
static BufferPool instance;
return instance;
}

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

- XrdClReplay.cc