Compartir a través de


concurrent_queue::try_pop Method

Dequeues an item from the queue if one is available. This method is concurrency-safe.

bool try_pop(
   _Ty& _Dest
);

Parameters

  • _Dest
    A reference to a location to store the dequeued item.

Return Value

true if an item was successfully dequeued,false otherwise.

Remarks

If an item was successfully dequeued, the parameter _Dest receives the dequeued value, the original value held in the queue is destroyed, and this function returns true. If there was no item to dequeue, this function returns false without blocking, and the contents of the _Dest parameter are undefined.

try_pop is concurrency-safe with respect to calls to the methods push, try_pop, and empty.

Requirements

Header: concurrent_queue.h

Namespace: concurrency

See Also

Reference

concurrent_queue Class