blob: 181a31754e24e2333c0440412198221ed1888125 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#ifndef INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP
#define INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP
#include <uhd/types/metadata.hpp>
#include <boost/lockfree/queue.hpp>
namespace uhd { namespace rfnoc {
/*!
* Implements queue of async messages originating from the tx data transport
* and from the rfnoc graph.
*/
class tx_async_msg_queue
{
public:
using sptr = std::shared_ptr<tx_async_msg_queue>;
//! Constructor
tx_async_msg_queue(size_t capacity);
/*!
* Retrieve async message from queue
*
* \param async_metadata the metadata to be filled in
* \param timeout_ms the timeout in milliseconds to wait for a message
* \return true when the async_metadata is valid, false for timeout
*/
bool recv_async_msg(async_metadata_t& async_metadata, int32_t timeout_ms);
/*!
* Push an async message onto the queue
*
* \param async_metadata the metadata to be pushed
*/
void enqueue(const async_metadata_t& async_metadata);
private:
boost::lockfree::queue<async_metadata_t> _queue;
};
}} // namespace uhd::rfnoc
#endif /* INCLUDED_LIBUHD_TX_ASYNC_MSG_QUEUE_HPP */
|