2010-08-11 89 views
2

我已经通过以下方法创建一个boost :: message_queue:我在做什么错boost :: interprocess :: 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抛出每次出现以下异常

exception: invalid string position

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

回答

3

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

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