#1.简介
ConcurrentQueue
是一个header only多线程库
A fast multi-producer, multi-consumer lock-free concurrent queue for C++11
Github地址:https://github.com/cameron314/concurrentqueue
#2.使用方法
>1.将以下2个文件复制到项目目录即可使用
concurrentqueue.h
blockingconcurrentqueue.h
>2.代码使用
#include "concurrentqueue.h"
#include "blockingconcurrentqueue.h"
using namespace std;
using namespace moodycamel;
#. 全部Api,伪代码
# Allocates more memory if necessary
enqueue(item) : bool
enqueue(prod_token, item) : bool
enqueue_bulk(item_first, count) : bool
enqueue_bulk(prod_token, item_first, count) : bool
# Fails if not enough memory to enqueue
try_enqueue(item) : bool
try_enqueue(prod_token, item) : bool
try_enqueue_bulk(item_first, count) : bool
try_enqueue_bulk(prod_token