---
name: "__gnu_parallel::_RestrictedBoundedConcurrentQueue"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_parallel::_RestrictedBoundedConcurrentQueue/3cxx"
---

# \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue(3cxx)

Double-ended queue of bounded size, allowing lock-free atomic access. push\_front() and pop\_front() must not be called concurrently to each other, while pop\_back() can be called concurrently at all times. empty(), size(), and top() are intentionally not provided. Calling them would not make sense in a concurrent setting.

## NAME

\_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \> - Double-ended queue of bounded size, allowing lock-free atomic access. push\_front() and pop\_front() must not be called concurrently to each other, while pop\_back() can be called concurrently at all times. `empty()`, `size()`, and `top()` are intentionally not provided. Calling them would not make sense in a concurrent setting.

## SYNOPSIS

`#include <queue.h>`

### Public Member Functions

**\_RestrictedBoundedConcurrentQueue** (**\_SequenceIndex** \_\_max\_size)\
 Constructor. Not to be called concurrent, of course.  **~\_RestrictedBoundedConcurrentQueue** ()\
 Destructor. Not to be called concurrent, of course.  bool **pop\_back** (\_Tp &\_\_t)\
 Pops one element from the queue at the front end. Must not be called concurrently with pop\_front().  bool **pop\_front** (\_Tp &\_\_t)\
 Pops one element from the queue at the front end. Must not be called concurrently with pop\_front().  void **push\_front** (const \_Tp &\_\_t)\
 Pushes one element into the queue at the front end. Must not be called concurrently with pop\_front().

## Detailed Description

### template\<typename \_Tp\>

class \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>"Double-ended queue of bounded size, allowing lock-free atomic access. push\_front() and pop\_front() must not be called concurrently to each other, while pop\_back() can be called concurrently at all times. `empty()`, `size()`, and `top()` are intentionally not provided. Calling them would not make sense in a concurrent setting.

**Parameters**

*\_Tp* Contained element type.

## Constructor & Destructor Documentation

### template\<typename \_Tp \> \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>::\_RestrictedBoundedConcurrentQueue (\_SequenceIndex \_\_max\_size)` [inline]`

Constructor. Not to be called concurrent, of course.

**Parameters**

*\_\_max\_size* Maximal number of elements to be contained.

References **\_\_gnu\_parallel::\_\_encode2()**.

### template\<typename \_Tp \> \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>::~\_RestrictedBoundedConcurrentQueue ()` [inline]`

Destructor. Not to be called concurrent, of course.

## Member Function Documentation

### template\<typename \_Tp \> bool \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>::pop\_back (\_Tp & \_\_t)` [inline]`

Pops one element from the queue at the front end. Must not be called concurrently with pop\_front().

References **\_\_gnu\_parallel::\_\_compare\_and\_swap()**, **\_\_gnu\_parallel::\_\_decode2()**, and **\_\_gnu\_parallel::\_\_encode2()**.

### template\<typename \_Tp \> bool \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>::pop\_front (\_Tp & \_\_t)` [inline]`

Pops one element from the queue at the front end. Must not be called concurrently with pop\_front().

References **\_\_gnu\_parallel::\_\_compare\_and\_swap()**, **\_\_gnu\_parallel::\_\_decode2()**, and **\_\_gnu\_parallel::\_\_encode2()**.

### template\<typename \_Tp \> void \_\_gnu\_parallel::\_RestrictedBoundedConcurrentQueue\< \_Tp \>::push\_front (const \_Tp & \_\_t)` [inline]`

Pushes one element into the queue at the front end. Must not be called concurrently with pop\_front().

References **\_\_gnu\_parallel::\_\_decode2()**, **\_\_gnu\_parallel::\_\_encode2()**, and **\_\_gnu\_parallel::\_\_fetch\_and\_add()**.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
