【问题标题】:What am I doing wrong with boost::interprocess::message_queue?我对 boost::interprocess::message_queue 做错了什么?
【发布时间】:2011-03-28 10:47:10
【问题描述】:

我通过以下方式创建了一个 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-creation 都会抛出

异常:无效的字符串位置

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

【问题讨论】:

    标签: c++ boost message-queue


    【解决方案1】:

    你不能用'-'来命名一个进程间机制。它写在文档中:

    * 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...
    

    【讨论】:

      猜你喜欢
      • 2011-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-21
      • 2011-06-04
      • 1970-01-01
      • 2017-08-11
      • 2021-05-26
      相关资源
      最近更新 更多