template<
Type QueueType, typename T>
requires std::is_copy_constructible_v<T> && std::is_move_constructible_v<T> && std::is_default_constructible_v<T>
class marvin::containers::fifos::FIFO< QueueType, T >
A thread-safe, realtime-safe fifo.
Can be configured as either a single producer, single consumer queue (SPSC), a wrapper around cameron314's readerwriterqueue, or a multi producer, multi consumer queue (MPMC), a wrapper around cameron314's concurrentqueue.
Suitable for passing data between threads. If the queue is full, pushing will have no effect, and if the queue is empty, popping will return a std::nullopt
.
T
must be default-constructible, copy constructible and move constructible.
To empty the queue in a single loop:
class SomeClass {
public:
while(std::optional<int> current = m_fifo.tryPop()) {
std::cout << "Dequeued " << *current << "\n";
}
}
private:
marvin::utils::fifos::SPSC<int> m_fifo;
};
void emptyQueue() noexcept
Definition marvin_FIFO.h:90