treelite
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SpscQueue< T > Class Template Reference

Lock-free single-producer-single-consumer queue for each thread. More...

#include <spsc_queue.h>

Public Member Functions

void Push (const T &input)
 
bool Pop (T *output, uint32_t spin_count=300000)
 
void SignalForKill ()
 Signal to terminate the worker.
 

Protected Types

typedef char cache_line_pad_t[kL1CacheBytes]
 

Protected Member Functions

bool Enqueue (const T &input)
 

Protected Attributes

cache_line_pad_t pad0_
 
T *const buffer_
 
cache_line_pad_t pad1_
 
std::atomic< uint32_t > head_
 
cache_line_pad_t pad2_
 
std::atomic< uint32_t > tail_
 
cache_line_pad_t pad3_
 
std::atomic< int8_t > pending_ {0}
 
cache_line_pad_t pad4_
 
std::atomic< bool > exit_now_ {false}
 
std::mutex mutex_
 
std::condition_variable cv_
 

Static Protected Attributes

static constexpr const int kRingSize = 2
 

Detailed Description

template<typename T>
class SpscQueue< T >

Lock-free single-producer-single-consumer queue for each thread.

Definition at line 21 of file spsc_queue.h.


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