gpt4 book ai didi

c++ - 我对 boost::interprocess::message_queue 做错了什么?

转载 作者:搜寻专家 更新时间:2023-10-31 01:59:03 31 4
gpt4 key购买 nike

我通过以下方式创建了一个 boost::message_queue:

namespace bipc = boost::interprocess;

...

try {
bipc::message_queue::remove("EDBA90AC-289D-4825-98D9-F85185041676");

// The below throws exception, no matter what's the name of the queue...

boost::shared_ptr<bipc::message_queue> mq(new bipc::message_queue(bipc::create_only, "EDBA90AC-289D-4825-98D9-F85185041676", 32767, 256));

...
} catch (std::exception &e) {
std::cout << "exception: " << e.what() << std::endl;
}

现在,我无法让它工作,因为 mq - 创建每次出现以下异常时都会抛出

exception: invalid string position

这在 1.42 之前的 Boost 版本中可以正常工作,但现在不行了。 Boost 的 message_queue 的文档没有改变,所以没有任何帮助。我在这里做错了什么?

最佳答案

您不能在内部使用“-”来命名进程间机制。它写在文档中:

* Starts with a letter, lowercase or uppercase, such as a letter from a to z or from A to Z. Examples: Sharedmemory, sharedmemory, sHaReDmEmOrY...
* Can include letters, underscore, or digits. Examples: shm1, shm2and3, ShM3plus4...

关于c++ - 我对 boost::interprocess::message_queue 做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3459769/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com