-
Notifications
You must be signed in to change notification settings - Fork 383
Home
木头云 edited this page Jan 2, 2019
·
9 revisions
ipc::circ::queue
struct msg_t {
int pid_;
int dat_;
};
using queue_t = ipc::circ::queue<msg_t>;
auto msg_buff = new queue_t::array_t;
// thread 1
std::thread {
[] {
queue_t queue { msg_buff };
for (int i = 0; i < 10; ++i) {
queue.push(msg_t { 0, i });
}
queue.push(msg_t { -1, 0 });
}
}.detach();
// thread 2
std::thread {
[] {
queue_t queue { msg_buff };
queue.connect();
while(1) {
auto msg = queue->pop();
if (msg.pid_ < 0) break;
proc(msg);
}
queue.disconnect();
}
}.detach();namespaces
classes
ipc::bufferipc::circ::elem_arrayipc::circ::queueipc::routeipc::channelipc::spin_lockipc::rw_lockipc::shm::handleipc::tls::pointeripc::mem::pool_alloc
head files