Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OurConcurrentQueue< T, Allocator > Class Template Reference

Detailed Description

template<typename T, typename Allocator>
class thrill::common::OurConcurrentQueue< T, Allocator >

This is a queue, similar to std::queue and tbb::concurrent_queue, except that it uses mutexes for synchronization.

This implementation is only here to be used if the Intel TBB is not available.

Not all methods of tbb:concurrent_queue<> are available here, please add them if you need them. However, NEVER add any other methods that you might need.

StyleGuide is violated, because signatures MUST match those in the TBB version.

Definition at line 52 of file concurrent_queue.hpp.

+ Inheritance diagram for OurConcurrentQueue< T, Allocator >:

#include <concurrent_queue.hpp>

Public Types

using const_reference = const T &
using difference_type = std::ptrdiff_t
using reference = T &
using size_type = std::size_t
using value_type = T

Public Member Functions

 OurConcurrentQueue (const Allocator &alloc=Allocator())
 Constructor. More...
void clear ()
 Clears the queue. More...
template<typename... Arguments>
void emplace (Arguments &&...args)
bool empty () const
 Returns: true if queue has no items; false otherwise. More...
void push (const T &source)
 Pushes a copy of source onto back of the queue. More...
void push (T &&elem)
bool try_pop (T &destination)

Private Attributes

std::mutex mutex_
 the mutex to lock before accessing the queue More...
std::deque< T, Allocator > queue_
 the actual data queue More...

Member Typedef Documentation

using const_reference = const T &

Definition at line 57 of file concurrent_queue.hpp.

using difference_type = std::ptrdiff_t

Definition at line 59 of file concurrent_queue.hpp.

using reference = T &

Definition at line 56 of file concurrent_queue.hpp.

using size_type = std::size_t

Definition at line 58 of file concurrent_queue.hpp.

using value_type = T

Definition at line 55 of file concurrent_queue.hpp.

Constructor & Destructor Documentation

OurConcurrentQueue ( const Allocator &  alloc = Allocator())


Definition at line 70 of file concurrent_queue.hpp.

Member Function Documentation

void clear ( )

Clears the queue.

Definition at line 113 of file concurrent_queue.hpp.

void emplace ( Arguments &&...  args)

Pushes a new element into the queue. The element is constructed with given arguments.

Definition at line 89 of file concurrent_queue.hpp.

bool empty ( ) const

Returns: true if queue has no items; false otherwise.

Definition at line 95 of file concurrent_queue.hpp.

void push ( const T source)

Pushes a copy of source onto back of the queue.

Definition at line 74 of file concurrent_queue.hpp.

void push ( T &&  elem)

Pushes given element into the queue by utilizing element's move constructor

Definition at line 81 of file concurrent_queue.hpp.

bool try_pop ( T destination)

If value is available, pops it from the queue, assigns it to destination, and destroys the original value. Otherwise does nothing.

Definition at line 102 of file concurrent_queue.hpp.

Member Data Documentation

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