Documentation Home >> Headers >> <jss/mpsc_fifo.hpp> Header >> jss::mpsc_fifo >> jss::mpsc_fifo::try_pop member function

Retrieve a value from the front of the queue if there is one.

bool try_pop(T& target);


T must be MoveAssignable.


Checks whether there is an item on the queue without blocking. If the queue is empty then try_pop() returns immediately and target is unchanged, otherwise it removes the front item from the queue and move-assigns it to target. If an exception is thrown by the move constructor or move-assignment operator of T whilst retrieving the value then that item is lost.


true if an item was removed, or false otherwise.


Any exception thrown by the move constructor of T. jss::poisoned_queue if *this has been poisoned.


Only one thread may call pop() or try_pop() on a particular instance of jss::mpsc_fifo concurrently. If two threads call pop() or try_pop() on the same instance and neither call happens-before the other then the behaviour is undefined.

A call to push() synchronizes-with a call to try_pop() that retrieves the value pushed.


#include <jss/mpsc_fifo.hpp>

See Also