↰ Return to documentation for file (morpheus/_lib/include/morpheus/objects/fiber_queue.hpp
)
#pragma once
#include <boost/fiber/buffered_channel.hpp>
#include <boost/fiber/channel_op_status.hpp>
#include <pybind11/pybind11.h>// IWYU pragma: keep
#include <pybind11/pytypes.h>
#include <cstddef>
#include <memory>
namespace morpheus {
/****** Component public implementations *******************/
/****** FiberQueue****************************************/
class FiberQueue
{
public:
FiberQueue(std::size_t max_size);
boost::fibers::channel_op_status put(pybind11::object &&item, bool block = true, float timeout = 0.0);
boost::fibers::channel_op_status get(pybind11::object &item, bool block = true, float timeout = 0.0);
void close();
bool is_closed();
void join();
private:
boost::fibers::buffered_channel<pybind11::object> m_queue;
};
#pragma GCC visibility push(default)
/****** FiberQueueInterfaceProxy *************************/
struct FiberQueueInterfaceProxy
{
static std::shared_ptr<morpheus::FiberQueue> init(std::size_t max_size);
static void put(morpheus::FiberQueue &self, pybind11::object item, bool block = true, float timeout = 0.0);
static pybind11::object get(morpheus::FiberQueue &self, bool block = true, float timeout = 0.0);
static void close(morpheus::FiberQueue &self);
};
#pragma GCC visibility pop// end of group
} // namespace morpheus