代码之家  ›  专栏  ›  技术社区  ›  nhaa123

boost::interprocess::message\u queue有什么问题?

  •  2
  • nhaa123  · 技术社区  · 14 年前

    我通过以下方式创建了一个boost::message\u队列:

    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消息队列的文档没有改变,因此没有任何帮助。我做错什么了?

    1 回复  |  直到 14 年前
        1
  •  3
  •   Maxence SCHMITT    14 年前

    不能用“-”命名内部的进程间机制。文件上写着:

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