2010-08-11 85 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...