Thrill
0.1
|
Implements dynamically resizable buffered writing pool.
Definition at line 38 of file write_pool.hpp.
#include <write_pool.hpp>
Classes | |
struct | busy_entry |
Public Types | |
using | bid_type = typename block_type::bid_type |
using | block_type = BlockType |
using | busy_blocks_iterator = typename std::list< busy_entry >::iterator |
using | free_blocks_iterator = typename std::list< block_type * >::iterator |
Public Member Functions | |
write_pool (size_t init_size=1) | |
write_pool (const write_pool &)=delete | |
non-copyable: delete copy-constructor More... | |
~write_pool () | |
Waits for completion of all ongoing write requests and frees memory. More... | |
void | add (block_type *&block) |
bool | has_request (bid_type bid) |
write_pool & | operator= (const write_pool &)=delete |
non-copyable: delete assignment operator More... | |
void | resize (size_t new_size) |
size_t | size () const |
Returns number of owned blocks. More... | |
block_type * | steal () |
std::pair< block_type *, request_ptr > | steal_request (bid_type bid) |
void | swap (write_pool &obj) |
request_ptr | write (block_type *&block, bid_type bid) |
Protected Member Functions | |
void | check_all_busy () |
Protected Attributes | |
std::list< busy_entry > | busy_blocks |
std::list< block_type * > | free_blocks |
Static Private Attributes | |
static constexpr bool | debug = false |
using bid_type = typename block_type::bid_type |
Definition at line 44 of file write_pool.hpp.
using block_type = BlockType |
Definition at line 43 of file write_pool.hpp.
using busy_blocks_iterator = typename std::list<busy_entry>::iterator |
Definition at line 61 of file write_pool.hpp.
using free_blocks_iterator = typename std::list<block_type*>::iterator |
Definition at line 60 of file write_pool.hpp.
|
inlineexplicit |
Constructs pool.
init_size | initial number of blocks in the pool |
Definition at line 72 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL, and write_pool< BlockType >::operator=().
|
delete |
non-copyable: delete copy-constructor
|
inline |
Waits for completion of all ongoing write requests and frees memory.
Definition at line 93 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL.
|
inline |
Definition at line 227 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL.
Referenced by read_write_pool< BlockType >::add(), prefetch_pool< BlockType >::hint(), and prefetch_pool< BlockType >::read().
|
inlineprotected |
Definition at line 235 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL.
Referenced by write_pool< BlockType >::steal().
|
inline |
Definition at line 195 of file write_pool.hpp.
Referenced by prefetch_pool< BlockType >::hint(), and prefetch_pool< BlockType >::read().
|
delete |
non-copyable: delete assignment operator
Referenced by write_pool< BlockType >::write_pool().
|
inline |
Resizes size of the pool.
new_size | new size of the pool after the call |
Definition at line 177 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL, write_pool< BlockType >::size(), and write_pool< BlockType >::steal().
Referenced by read_write_pool< BlockType >::resize_write().
|
inline |
Returns number of owned blocks.
Definition at line 123 of file write_pool.hpp.
Referenced by write_pool< BlockType >::resize(), read_write_pool< BlockType >::size_write(), and write_pool< BlockType >::steal().
|
inline |
Take out a block from the pool.
Definition at line 154 of file write_pool.hpp.
References write_pool< BlockType >::check_all_busy(), FOXXLL_VERBOSE_WPOOL, write_pool< BlockType >::size(), and foxxll::wait_any().
Referenced by write_pool< BlockType >::resize(), and read_write_pool< BlockType >::steal().
|
inline |
Definition at line 206 of file write_pool.hpp.
References FOXXLL_VERBOSE_WPOOL, and write_pool< BlockType >::busy_entry::req.
Referenced by prefetch_pool< BlockType >::hint(), and prefetch_pool< BlockType >::read().
|
inline |
Definition at line 86 of file write_pool.hpp.
References write_pool< BlockType >::busy_blocks, and write_pool< BlockType >::free_blocks.
Referenced by std::swap().
|
inline |
Passes a block to the pool for writing.
block | block to write. Ownership of the block goes to the pool. block must be allocated dynamically with using new . |
bid | location, where to write |
block
must be allocated dynamically with using new
. Definition at line 131 of file write_pool.hpp.
References write_pool< BlockType >::busy_entry::busy_entry(), and FOXXLL_VERBOSE_WPOOL.
Referenced by read_write_pool< BlockType >::write().
|
protected |
Definition at line 67 of file write_pool.hpp.
Referenced by write_pool< BlockType >::swap().
|
staticprivate |
Definition at line 40 of file write_pool.hpp.
|
protected |
Definition at line 65 of file write_pool.hpp.
Referenced by write_pool< BlockType >::swap().