CIRCT  19.0.0git
Public Member Functions | Private Types | Private Attributes | List of all members
esi::cosim::TSQueue< T > Class Template Reference

Thread safe queue. Just wraps std::queue protected with a lock. More...

#include <Utils.h>

Inheritance diagram for esi::cosim::TSQueue< T >:
Inheritance graph
[legend]
Collaboration diagram for esi::cosim::TSQueue< T >:
Collaboration graph
[legend]

Public Member Functions

template<typename... E>
void push (E... t)
 Push onto the queue. More...
 
std::optional< T > pop ()
 Pop something off the queue but return nullopt if the queue is empty. More...
 

Private Types

using Lock = std::lock_guard< std::mutex >
 

Private Attributes

std::mutex m
 
std::queue< T > q
 

Detailed Description

template<typename T>
class esi::cosim::TSQueue< T >

Thread safe queue. Just wraps std::queue protected with a lock.

Definition at line 21 of file Utils.h.

Member Typedef Documentation

◆ Lock

template<typename T >
using esi::cosim::TSQueue< T >::Lock = std::lock_guard<std::mutex>
private

Definition at line 22 of file Utils.h.

Member Function Documentation

◆ pop()

template<typename T >
std::optional<T> esi::cosim::TSQueue< T >::pop ( )
inline

Pop something off the queue but return nullopt if the queue is empty.

Why doesn't std::queue have anything like this?

Definition at line 37 of file Utils.h.

References esi::cosim::TSQueue< T >::m, and esi::cosim::TSQueue< T >::q.

Referenced by sv2cCosimserverMMIOReadTryGet(), and sv2cCosimserverMMIOWriteTryGet().

◆ push()

template<typename T >
template<typename... E>
void esi::cosim::TSQueue< T >::push ( E...  t)
inline

Push onto the queue.

Definition at line 30 of file Utils.h.

References esi::cosim::TSQueue< T >::m, and esi::cosim::TSQueue< T >::q.

Referenced by sv2cCosimserverMMIOReadRespond(), and sv2cCosimserverMMIOWriteRespond().

Member Data Documentation

◆ m

template<typename T >
std::mutex esi::cosim::TSQueue< T >::m
private

Definition at line 24 of file Utils.h.

Referenced by esi::cosim::TSQueue< T >::pop(), and esi::cosim::TSQueue< T >::push().

◆ q

template<typename T >
std::queue<T> esi::cosim::TSQueue< T >::q
private

Definition at line 25 of file Utils.h.

Referenced by esi::cosim::TSQueue< T >::pop(), and esi::cosim::TSQueue< T >::push().


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