An experimental self learning project.
auto const params = pika::ChannelParameters {
.channel_name = "/test", .queue_size = 4, .channel_type = pika::ChannelType::InterProcess
};
auto producer = pika::Channel::CreateProducer<int>(params);
producer->Connect();
producer->Send(44);
auto const params = pika::ChannelParameters {
.channel_name = "/test", .queue_size = 4, .channel_type = pika::ChannelType::InterProcess
};
auto consumer = pika::Channel::CreateConsumer<int>(params);
consumer->Connect();
int recv_packet {};
consumer->Receive(recv_packet);
assert(recv_packet == 44);
auto const params = pika::ChannelParameters { .channel_name = "/test",
.queue_size = 1,
.channel_type = pika::ChannelType::InterThread,
.single_producer_single_consumer_mode = true
};
auto producer = pika::Channel::CreateProducer<int>(params);
producer->Connect();
producer->Send(44);
auto const params = pika::ChannelParameters { .channel_name = "/test",
.queue_size = 1,
.channel_type = pika::ChannelType::InterThread,
.single_producer_single_consumer_mode = true
};
auto consumer = pika::Channel::CreateConsumer<int>(params);
consumer->Connect();
int recv_packet {};
consumer->Receive(recv_packet);
assert(recv_packet == 44);