activemq-cpp-3.9.5
decaf::internal::util::concurrent::TransferQueue< E > Class Template Reference

This extends Scherer-Scott dual queue algorithm, differing, among other ways, by using modes within nodes rather than marked pointers. More...

#include <src/main/decaf/internal/util/concurrent/TransferQueue.h>

Inheritance diagram for decaf::internal::util::concurrent::TransferQueue< E >:

Public Member Functions

 TransferQueue ()
 Node class for TransferQueue.
 
virtual ~TransferQueue ()
 
virtual void transfer (E *e, bool timed, long long nanos)
 Performs a put.
 
virtual E * transfer (bool timed, long long nanos)
 Performs a take.
 

Detailed Description

template<typename E>
class decaf::internal::util::concurrent::TransferQueue< E >

This extends Scherer-Scott dual queue algorithm, differing, among other ways, by using modes within nodes rather than marked pointers.

The algorithm is a little simpler than that for stacks because fulfillers do not need explicit nodes, and matching is done by CAS'ing QNode.item field from non-null to null (for put) or vice versa (for take).

Constructor & Destructor Documentation

◆ TransferQueue()

template<typename E>
decaf::internal::util::concurrent::TransferQueue< E >::TransferQueue ( )
inline

Node class for TransferQueue.

Tries to cancel by CAS'ing ref to NULL if that succeeds then we mark as cancelled. Returns true if this node is known to be off the queue because its next pointer has been forgotten due to an advanceHead operation.

◆ ~TransferQueue()

template<typename E>
virtual decaf::internal::util::concurrent::TransferQueue< E >::~TransferQueue ( )
inlinevirtual

Member Function Documentation

◆ transfer() [1/2]

template<typename E>
virtual E * decaf::internal::util::concurrent::TransferQueue< E >::transfer ( bool timed,
long long nanos )
inlinevirtual

Performs a take.

Parameters
timedif this operation should timeout
nanosthe timeout, in nanoseconds
Returns
the item provided or received;
Exceptions
TimeoutExceptionif the operation timed out waiting for the producer to offer an item.
InterruptedExceptionif the thread was interrupted while waiting for the producer to offer an item.

Implements decaf::internal::util::concurrent::Transferer< E >.

References NULL.

◆ transfer() [2/2]

template<typename E>
virtual void decaf::internal::util::concurrent::TransferQueue< E >::transfer ( E * e,
bool timed,
long long nanos )
inlinevirtual

Performs a put.

Parameters
ethe item to be handed to a consumer;
timedif this operation should timeout
nanosthe timeout, in nanoseconds
Exceptions
TimeoutExceptionif the operation timed out waiting for the consumer to accept the item offered.
InterruptedExceptionif the thread was interrupted while waiting for the consumer to accept the item offered.

Implements decaf::internal::util::concurrent::Transferer< E >.


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