pulsatrix
Loading...
Searching...
No Matches
pulsatrix::BoundedQueue< T > Class Template Reference

Fixed-capacity thread-safe queue with blocking push/pop – the bounded buffer between pulsatrix data-pipeline stages (campaign_exai_dl_library_data_pipeline). Not tied to any Dataset/DataLoader type; deliberately generic. More...

#include <bounded_queue.hpp>

Public Member Functions

 BoundedQueue (size_t capacity)
 
void push (T item)
 Pushes an item, blocking while the queue is full.
 
std::optional< T > pop ()
 Pops the next item, blocking while the queue is empty and not closed.
 
void close ()
 Signals no more pushes will occur; unblocks every waiting push()/pop().
 

Detailed Description

template<typename T>
class pulsatrix::BoundedQueue< T >

Fixed-capacity thread-safe queue with blocking push/pop – the bounded buffer between pulsatrix data-pipeline stages (campaign_exai_dl_library_data_pipeline). Not tied to any Dataset/DataLoader type; deliberately generic.

Note
This is pulsatrix's first concurrent code path (data_pipeline campaign, Risk Register: "Threading model correctness"). No production DataLoader path exercises this class yet in Phase 1 – DataLoader defaults to num_workers=0 (fully synchronous); wiring this into DataLoader's fetch/collate stages is a later, separately-tested mission (Decision Point 7).

Constructor & Destructor Documentation

◆ BoundedQueue()

template<typename T >
pulsatrix::BoundedQueue< T >::BoundedQueue ( size_t  capacity)
inlineexplicit

Member Function Documentation

◆ close()

template<typename T >
void pulsatrix::BoundedQueue< T >::close ( )
inline

Signals no more pushes will occur; unblocks every waiting push()/pop().

◆ pop()

template<typename T >
std::optional< T > pulsatrix::BoundedQueue< T >::pop ( )
inline

Pops the next item, blocking while the queue is empty and not closed.

Returns
The next item, or std::nullopt once closed AND drained.

◆ push()

template<typename T >
void pulsatrix::BoundedQueue< T >::push ( T  item)
inline

Pushes an item, blocking while the queue is full.

Note
A push after close() is silently dropped – close() means "no more producers", so a caller racing a push against its own close() call has a logic error, not something this queue can meaningfully recover from.

The documentation for this class was generated from the following file: