QuantumLibrary
Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS > Struct Template Reference

Provides fast (quasi zero-time) in-place allocation for coroutines. Coroutine stacks are pre-allocated from separate (i.e. non-contiguous) heap blocks and maintained in a reusable list. More...

#include <quantum_coroutine_pool_allocator.h>

Public Types

typedef CoroutinePoolAllocator< STACK_TRAITS > this_type
 
typedef size_t size_type
 
typedef uint16_t index_type
 
typedef STACK_TRAITS traits
 

Public Member Functions

 CoroutinePoolAllocator (index_type size)
 
 CoroutinePoolAllocator (const this_type &)=delete
 
 CoroutinePoolAllocator (this_type &&)
 
CoroutinePoolAllocatoroperator= (const this_type &)=delete
 
CoroutinePoolAllocatoroperator= (this_type &&)
 
virtual ~CoroutinePoolAllocator ()
 
boost::context::stack_context allocate ()
 
void deallocate (const boost::context::stack_context &ctx)
 
size_t allocatedBlocks () const
 
size_t allocatedHeapBlocks () const
 
bool isFull () const
 
bool isEmpty () const
 

Detailed Description

template<typename STACK_TRAITS>
struct Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >

Provides fast (quasi zero-time) in-place allocation for coroutines. Coroutine stacks are pre-allocated from separate (i.e. non-contiguous) heap blocks and maintained in a reusable list.

Note
This allocator is thread safe. For internal use only and is meant to replace the boost fixed size pool allocator which crashes.

Member Typedef Documentation

◆ index_type

template<typename STACK_TRAITS >
typedef uint16_t Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::index_type

◆ size_type

template<typename STACK_TRAITS >
typedef size_t Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::size_type

◆ this_type

template<typename STACK_TRAITS >
typedef CoroutinePoolAllocator<STACK_TRAITS> Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::this_type

◆ traits

template<typename STACK_TRAITS >
typedef STACK_TRAITS Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::traits

Constructor & Destructor Documentation

◆ CoroutinePoolAllocator() [1/3]

template<typename STACK_TRAITS >
Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::CoroutinePoolAllocator ( index_type  size)

◆ CoroutinePoolAllocator() [2/3]

template<typename STACK_TRAITS >
Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::CoroutinePoolAllocator ( const this_type )
delete

◆ CoroutinePoolAllocator() [3/3]

template<typename STACK_TRAITS >
Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::CoroutinePoolAllocator ( this_type &&  other)

◆ ~CoroutinePoolAllocator()

template<typename STACK_TRAITS >
Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::~CoroutinePoolAllocator ( )
virtual

Member Function Documentation

◆ allocate()

template<typename STACK_TRAITS >
boost::context::stack_context Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::allocate ( )

◆ allocatedBlocks()

template<typename STACK_TRAITS >
size_t Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::allocatedBlocks ( ) const

◆ allocatedHeapBlocks()

template<typename STACK_TRAITS >
size_t Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::allocatedHeapBlocks ( ) const

◆ deallocate()

template<typename STACK_TRAITS >
void Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::deallocate ( const boost::context::stack_context &  ctx)

◆ isEmpty()

template<typename STACK_TRAITS >
bool Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::isEmpty ( ) const

◆ isFull()

template<typename STACK_TRAITS >
bool Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::isFull ( ) const

◆ operator=() [1/2]

template<typename STACK_TRAITS >
CoroutinePoolAllocator& Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::operator= ( const this_type )
delete

◆ operator=() [2/2]

template<typename STACK_TRAITS >
CoroutinePoolAllocator< STACK_TRAITS > & Bloomberg::quantum::CoroutinePoolAllocator< STACK_TRAITS >::operator= ( this_type &&  other)