Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::parallel::ThreadSafeQueue< T > Class Template Reference

A simple thread-safe (mutex + condition-variable) FIFO queue. More...

#include <thread_pool.hpp>

Public Member Functions

void push (T item)
 Push an item onto the queue and wake one waiter.
T pop ()
 Block until an item is available, then pop and return it.
std::optional< T > try_pop ()
 Pop and return an item if one is ready, otherwise std::nullopt (non-blocking).

Detailed Description

template<typename T>
class bertini::parallel::ThreadSafeQueue< T >

A simple thread-safe (mutex + condition-variable) FIFO queue.

Member Function Documentation

◆ pop()

template<typename T>
T bertini::parallel::ThreadSafeQueue< T >::pop ( )
inline

Block until an item is available, then pop and return it.

◆ push()

template<typename T>
void bertini::parallel::ThreadSafeQueue< T >::push ( T item)
inline

Push an item onto the queue and wake one waiter.

◆ try_pop()

template<typename T>
std::optional< T > bertini::parallel::ThreadSafeQueue< T >::try_pop ( )
inline

Pop and return an item if one is ready, otherwise std::nullopt (non-blocking).