---
title: llarp::thread::QueueManager

---

# llarp::thread::QueueManager





## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::atomic< std::uint32_t > | **[AtomicIndex](Classes/classllarp_1_1thread_1_1QueueManager.md#using-atomicindex)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| int32_t | **[circularDifference](Classes/classllarp_1_1thread_1_1QueueManager.md#function-circulardifference)**(uint32_t startingValue, uint32_t subtractValue, uint32_t modulo) |
| uint32_t | **[numGenerations](Classes/classllarp_1_1thread_1_1QueueManager.md#function-numgenerations)**(size_t capacity) |
| | **[QueueManager](Classes/classllarp_1_1thread_1_1QueueManager.md#function-queuemanager)**(size_t capacity) |
| | **[~QueueManager](Classes/classllarp_1_1thread_1_1QueueManager.md#function-~queuemanager)**() |
| QueueReturn | **[reservePushIndex](Classes/classllarp_1_1thread_1_1QueueManager.md#function-reservepushindex)**(uint32_t & generation, uint32_t & index) |
| void | **[commitPushIndex](Classes/classllarp_1_1thread_1_1QueueManager.md#function-commitpushindex)**(uint32_t generation, uint32_t index) |
| QueueReturn | **[reservePopIndex](Classes/classllarp_1_1thread_1_1QueueManager.md#function-reservepopindex)**(uint32_t & generation, uint32_t & index) |
| void | **[commitPopIndex](Classes/classllarp_1_1thread_1_1QueueManager.md#function-commitpopindex)**(uint32_t generation, uint32_t index) |
| void | **[disable](Classes/classllarp_1_1thread_1_1QueueManager.md#function-disable)**() |
| void | **[enable](Classes/classllarp_1_1thread_1_1QueueManager.md#function-enable)**() |
| bool | **[reservePopForClear](Classes/classllarp_1_1thread_1_1QueueManager.md#function-reservepopforclear)**(uint32_t & generation, uint32_t & index, uint32_t endGeneration, uint32_t endIndex) |
| void | **[abortPushIndexReservation](Classes/classllarp_1_1thread_1_1QueueManager.md#function-abortpushindexreservation)**(uint32_t generation, uint32_t index) |
| bool | **[enabled](Classes/classllarp_1_1thread_1_1QueueManager.md#function-enabled)**() const |
| size_t | **[size](Classes/classllarp_1_1thread_1_1QueueManager.md#function-size)**() const |
| size_t | **[capacity](Classes/classllarp_1_1thread_1_1QueueManager.md#function-capacity)**() const |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| constexpr size_t | **[Alignment](Classes/classllarp_1_1thread_1_1QueueManager.md#variable-alignment)**  |
| constexpr size_t | **[MAX_CAPACITY](Classes/classllarp_1_1thread_1_1QueueManager.md#variable-max-capacity)**  |

## Public Types Documentation

### using AtomicIndex

```cpp
using llarp::thread::QueueManager::AtomicIndex =  std::atomic<std::uint32_t>;
```


## Public Functions Documentation

### function circularDifference

```cpp
static int32_t circularDifference(
    uint32_t startingValue,
    uint32_t subtractValue,
    uint32_t modulo
)
```


### function numGenerations

```cpp
static uint32_t numGenerations(
    size_t capacity
)
```


### function QueueManager

```cpp
explicit QueueManager(
    size_t capacity
)
```


### function ~QueueManager

```cpp
~QueueManager()
```


### function reservePushIndex

```cpp
QueueReturn reservePushIndex(
    uint32_t & generation,
    uint32_t & index
)
```


### function commitPushIndex

```cpp
void commitPushIndex(
    uint32_t generation,
    uint32_t index
)
```


### function reservePopIndex

```cpp
QueueReturn reservePopIndex(
    uint32_t & generation,
    uint32_t & index
)
```


### function commitPopIndex

```cpp
void commitPopIndex(
    uint32_t generation,
    uint32_t index
)
```


### function disable

```cpp
void disable()
```


### function enable

```cpp
void enable()
```


### function reservePopForClear

```cpp
bool reservePopForClear(
    uint32_t & generation,
    uint32_t & index,
    uint32_t endGeneration,
    uint32_t endIndex
)
```


### function abortPushIndexReservation

```cpp
void abortPushIndexReservation(
    uint32_t generation,
    uint32_t index
)
```


### function enabled

```cpp
bool enabled() const
```


### function size

```cpp
size_t size() const
```


### function capacity

```cpp
size_t capacity() const
```


## Public Attributes Documentation

### variable Alignment

```cpp
static constexpr size_t Alignment = 64;
```


### variable MAX_CAPACITY

```cpp
static constexpr size_t MAX_CAPACITY = 1 << ((sizeof(uint32_t) * 8) - 2);
```


-------------------------------

Updated on 2023-01-09 at 18:23:49 +0000