FastFlow  SVN-r182-Aug-14-2014
A high-level, lock-less, parallel programming (shared-memory) and distributed programming (distributed-memory) framework for multi-cores and many-cores systems
 All Classes Namespaces Files Functions Variables Typedefs Groups Pages
Files | Classes
Auxiliary classes and functions

Auxiliary classes. More...

Files

file  dynlinkedlist.hpp
 Dynamic linked list Single-Writer Single-Reader unbounded queue. Not currently used.
 
file  dynqueue.hpp
 Implementation of a dynamic queue. Not currently used.
 
file  ff_queue.hpp
 Experimental. Not currently used.
 
file  MPMCqueues.hpp
 This file contains several MPMC queue implementations. Not currently used.
 
file  squeue.hpp
 Simple yet efficient (not concurrent) unbounded FIFO queue.
 
file  staticlinkedlist.hpp
 Static Linked List. Not currently used.
 
file  svector.hpp
 Simple yet efficient dynamic vector.
 
file  utils.hpp
 Utility functions.
 

Classes

class  ff::Lamport_Buffer
 Implementation of the well-known Lamport's wait-free circular buffer. Not currently used. More...
 
class  ff::MPMC_Ptr_Queue
 An implementation of the bounded Multi-Producer/Multi-Consumer queue. Not currently used. More...
 
class  ff::MSqueue
 Michael and Scott MPMC. Not currently used. More...
 
class  ff::squeue< T >
 Unbound sequential FIFO queue. More...
 
class  ff::svector< T >
 Simple yet efficient dynamic vector. More...
 

Detailed Description

Auxiliary classes.

Auxiliary classes: general utility classes and algorithms


Class Documentation

class ff::Lamport_Buffer

Implementation of the well-known Lamport's wait-free circular buffer. Not currently used.

Public Member Functions

 Lamport_Buffer (unsigned long n, const bool=true)
 
 ~Lamport_Buffer ()
 
bool init ()
 
bool empty ()
 
bool available ()
 
unsigned long buffersize () const
 
bool push (void *const data)
 
bool pop (void **data)
 
void reset ()
 
unsigned long length () const
 

Constructor & Destructor Documentation

ff::Lamport_Buffer::Lamport_Buffer ( unsigned long  n,
const bool  = true 
)
inline

Constructor

ff::Lamport_Buffer::~Lamport_Buffer ( )
inline

Destructor

Member Function Documentation

bool ff::Lamport_Buffer::available ( )
inline

It return true if there is at least one room in the buffer

unsigned long ff::Lamport_Buffer::buffersize ( ) const
inline

TODO

bool ff::Lamport_Buffer::empty ( )
inline

It return true if the buffer is empty

bool ff::Lamport_Buffer::init ( )
inline

It initialize the circular buffer.

Returns
If successful true is returned, otherwise false is returned.

References reset().

unsigned long ff::Lamport_Buffer::length ( ) const
inline

TODO

bool ff::Lamport_Buffer::pop ( void **  data)
inline

TODO

References empty().

bool ff::Lamport_Buffer::push ( void *const  data)
inline

TODO

void ff::Lamport_Buffer::reset ( )
inline

TODO

class ff::MPMC_Ptr_Queue

An implementation of the bounded Multi-Producer/Multi-Consumer queue. Not currently used.

This class describes an implementation of the MPMC queue inspired by the solution proposed by Dmitry Vyukov.

Note
There are two versions 1) with atomic operations 2) using new C++0X standard (compile with -DUSE_STD_C0X).

Public Member Functions

bool init (size_t size)
 init
 
bool push (void *const data)
 push: enqueue data More...
 
bool pop (void **data)
 

Member Function Documentation

bool ff::MPMC_Ptr_Queue::pop ( void **  data)
inline

pop method: dequeue data from the queue.

This is a non-blocking method.

bool ff::MPMC_Ptr_Queue::push ( void *const  data)
inline

push: enqueue data

This method is non-blocking and costs one CAS per operation.

class ff::MSqueue

Michael and Scott MPMC. Not currently used.

See: M. Michael and M. Scott, "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms", PODC 1996.

The MSqueue implementation is inspired to the one in the liblfds libraly that is a portable, license-free, lock-free data structure library written in C. The liblfds implementation uses double-word CAS (aka DCAS) whereas this implementation uses only single-word CAS since it relies on a implementation of a memory allocator (used to allocate internal queue nodes) which implements a deferred reclamation algorithm able to solve both the ABA problem and the dangling pointer problem.

More info about liblfds can be found at http://www.liblfds.org

Public Member Functions

int init ()
 

Member Function Documentation

int ff::MSqueue::init ( )
inline

initialize the MSqueue

class ff::squeue

template<typename T>
class ff::squeue< T >

Unbound sequential FIFO queue.

class ff::svector

template<typename T>
class ff::svector< T >

Simple yet efficient dynamic vector.

This class is defined in svector.hpp

Public Member Functions

 svector (size_t chunk=SVECTOR_CHUNK)
 
 svector (const svector &v)
 
 svector (const_iterator i1, const_iterator i2)
 
 ~svector ()
 
svectoroperator= (const svector &v)
 
svectoroperator+= (const svector &v)
 
void reserve (size_t newcapacity)
 
void resize (size_t newsize)
 
void push_back (const vector_type &elem)
 
void pop_back ()
 
vector_type & back ()
 
vector_type & front ()
 
const vector_type & front () const
 
iterator erase (iterator where)
 
size_t size () const
 
bool empty () const
 
size_t capacity () const
 
void clear ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
vector_type & operator[] (size_t n)
 
const vector_type & operator[] (size_t n) const
 

Constructor & Destructor Documentation

template<typename T>
ff::svector< T >::svector ( size_t  chunk = SVECTOR_CHUNK)
inline
Parameters
chunkis the allocation chunk
template<typename T>
ff::svector< T >::svector ( const svector< T > &  v)
inline

Constructor

template<typename T>
ff::svector< T >::svector ( const_iterator  i1,
const_iterator  i2 
)
inline

Constructor

template<typename T>
ff::svector< T >::~svector ( )
inline

Destructor

Member Function Documentation

template<typename T>
vector_type& ff::svector< T >::back ( )
inline

back

template<typename T>
iterator ff::svector< T >::begin ( )
inline

begin

template<typename T>
const_iterator ff::svector< T >::begin ( ) const
inline

begin

template<typename T>
size_t ff::svector< T >::capacity ( ) const
inline

capacity

template<typename T>
void ff::svector< T >::clear ( )
inline

clear

template<typename T>
bool ff::svector< T >::empty ( ) const
inline

empty

template<typename T>
iterator ff::svector< T >::end ( )
inline

end

template<typename T>
const_iterator ff::svector< T >::end ( ) const
inline

end

template<typename T>
iterator ff::svector< T >::erase ( iterator  where)
inline

erease

template<typename T>
vector_type& ff::svector< T >::front ( )
inline

front

template<typename T>
const vector_type& ff::svector< T >::front ( ) const
inline

front

template<typename T>
svector& ff::svector< T >::operator+= ( const svector< T > &  v)
inline

Merge

template<typename T>
svector& ff::svector< T >::operator= ( const svector< T > &  v)
inline

Copy

template<typename T>
vector_type& ff::svector< T >::operator[] ( size_t  n)
inline

Access element

template<typename T>
const vector_type& ff::svector< T >::operator[] ( size_t  n) const
inline

Access element

template<typename T>
void ff::svector< T >::pop_back ( )
inline

pop_back

template<typename T>
void ff::svector< T >::push_back ( const vector_type &  elem)
inline

push_back

template<typename T>
void ff::svector< T >::reserve ( size_t  newcapacity)
inline

Reserve

template<typename T>
void ff::svector< T >::resize ( size_t  newsize)
inline

Resize

template<typename T>
size_t ff::svector< T >::size ( ) const
inline

size