#ifndef _TASK_QUEUE_H_
#define _TASK_QUEUE_H_
#include <string>
#include <queue>
#include <boost/thread.hpp>
template<class T>
class TaskQueue
{
public:
TaskQueue(){
queue_.clear();
}
virtual ~TaskQueue(){
};
/**
* @Appends the task to the queue
* @param the task object
**/
virtual void append(const T& _t){
thr_lck lck(mtx_);
queue_.push(_t);
}
/**
* @Return the current size of the queue
* @returns the queue size
**/
virtual size_t queueSize() const {
thr_lck lck(mtx_);
return queue_.size();
}
/**
* @Return the queue
* @returns the message queue
**/
virtual bool empty() {
thr_lck lck(mtx_);
return queue_.empty();
}
/**
* @Return the queue
* @returns the message queue
**/
virtu
C++队列模板使用std::queue
最新推荐文章于 2024-06-08 18:30:35 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)