【发布时间】:2013-09-14 00:35:47
【问题描述】:
我正在尝试spsc_queue.pop() 这个struct
enum action_type {
SUBSCRIBE,
UNSUBSCRIBE,
MESSAGE
};
struct action {
action() = default ;
action(action_type t, connection_hdl h) : type(t), hdl(h) {}
action(action_type t, server::message_ptr m) : type(t), msg(m) {}
action_type type;
websocketpp::connection_hdl hdl;
server::message_ptr msg;
};
与
action a;
while(m_actions.pop(a)){
...
但每当我测试时
std::cout << "'" << a.type << "'" << std::endl;
'0' 被写入终端,但它应该只是action_type 的值之一。我读过struct 的默认值是0,但为什么spsc_queue.pop() 不能设置a?
【问题讨论】:
标签: c++ boost struct queue lock-free