作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我通过以下方式创建了一个 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/
我是一名优秀的程序员,十分优秀!