/*
|
* =====================================================================================
|
*
|
* Filename: shm_queue.h
|
*
|
* Description:
|
*
|
* Version: 1.0
|
* Created: 2021年03月25日 10时35分09秒
|
* Revision: none
|
* Compiler: gcc
|
*
|
* Author: Li Chao (),
|
* Organization:
|
*
|
* =====================================================================================
|
*/
|
|
#ifndef SHM_QUEUE_JE0OEUP3
|
#define SHM_QUEUE_JE0OEUP3
|
|
#include "robust.h"
|
#include "shm.h"
|
#include <atomic>
|
#include <boost/circular_buffer.hpp>
|
#include <chrono>
|
|
namespace bhome_shm
|
{
|
|
// just wrap robust::AtomicQ63
|
class SharedQ63
|
{
|
public:
|
template <class... T>
|
explicit SharedQ63(T &&...t) {} // easy testing
|
|
typedef robust::AtomicQ63 AQ63;
|
typedef AQ63::Data Data;
|
bool TryRead(Data &d, const bool try_more = true) { return queue_.pop(d, try_more); }
|
bool TryWrite(const Data d, const bool try_more = true) { return queue_.push(d, try_more); }
|
|
private:
|
AQ63 queue_;
|
};
|
|
} // namespace bhome_shm
|
|
#endif // end of include guard: SHM_QUEUE_JE0OEUP3
|