DAWorkbench 0.0.1
DAWorkbench API
载入中...
搜索中...
未找到
da_concurrent_queue< T > 模板类 参考

这个是专门为生产者消费者实现的安全FIFO 更多...

#include <da_concurrent_queue.hpp>

Public 类型

using queue_type = std::queue< T >
 
using value_type = typename queue_type::value_type
 
using reference = typename queue_type::reference
 
using const_reference = typename queue_type::const_reference
 
using size_type = typename queue_type::size_type
 
using mutex_type = std::mutex
 
using lock_guard_type = std::lock_guard< mutex_type >
 
using unique_lock_type = std::unique_lock< mutex_type >
 

Public 成员函数

 da_concurrent_queue ()
 构造函数,不限制容量的队列
 
 da_concurrent_queue (size_type capacity)
 构造函数,可指定最大容量
 
bool empty () const
 队列是否为空
 
std::size_t size () const
 获取队列的尺寸
 
void push (const T &v)
 推入fifo
 
void set (const T &v)
 
get ()
 推出
 
get (int waitms)
 有等待时间的获取
 

详细描述

template<typename T>
class da_concurrent_queue< T >

这个是专门为生产者消费者实现的安全FIFO

可以实现空等待,满等待

构造及析构函数说明

◆ da_concurrent_queue()

template<typename T >
da_concurrent_queue< T >::da_concurrent_queue ( size_type  capacity)

构造函数,可指定最大容量

参数
capacity容量,0代表不做限制

成员函数说明

◆ empty()

template<typename T >
bool da_concurrent_queue< T >::empty ( ) const

队列是否为空

返回

◆ get() [1/2]

template<typename T >
T da_concurrent_queue< T >::get ( )

推出

返回

◆ get() [2/2]

template<typename T >
T da_concurrent_queue< T >::get ( int  waitms)

有等待时间的获取

参数
waitms等待的毫秒,如果超过时间还无法获取也返回一个默认构造的类型
返回

◆ push()

template<typename T >
void da_concurrent_queue< T >::push ( const T &  v)

推入fifo

如果队列已经满,则等待,直到有容积

参数
v

◆ size()

template<typename T >
std::size_t da_concurrent_queue< T >::size ( ) const

获取队列的尺寸

返回

该类的文档由以下文件生成: