Reserve the next available index from which to dequeue an element from an (externally managed) circular buffer; load the specified index with the reserved index and load the specified generation with the current generation of the circular buffer. Return 0 on success, and a non‐zero value if the queue is empty. If this method succeeds, other threads using this object may spin on the corresponding index state until commitPopIndex is called using the returned index and generation values; clients should call commitPopIndex quickly after this method returns, without performing any blocking operations. If this method fails the generation and index will be unmodified. The behavior is undefined if the current thread is already holding a reservation on either a push or pop index. Note that generation is necessary for invoking commitPopIndex but should not otherwise be used by the caller; the value reflects the of times the index in the circular buffer has been used.

Synopsis

Declared in <bdlcc_fixedqueueindexmanager.h>

int
reservePopIndex(
    unsigned int* generation,
    unsigned int* index);

Created with MrDocs