Boost Message Queue not based on POSIX message queue? Impossible to select(2)?

后端 未结 2 1015
星月不相逢
星月不相逢 2021-02-15 12:30

I thought I\'d use Boost.Interprocess\'s Message Queue in place of sockets for communication within one host. But after digging into it, it seems that this library for some rea

相关标签:
2条回答
  • 2021-02-15 13:10

    I ran into a similar situation the other day when using Boost.Interprocess' sync classes: namely the condition class. It's implemented in a "generic" manner, but the way it has been done is to use a custom spinlock which is highly inefficient (on OS X at least). For all intents and purposes it made the sync classes useless.

    In my experience the Interprocess library is pretty immature. I use it for shared memory, and it does work pretty well but there are some rough edges and I've had to hack around some "missing features" such as dynamically resizing shared memory etc.

    In summary, don't expect this library to be a silver bullet just yet. It's good, but not exceptional at this time.

    0 讨论(0)
  • 2021-02-15 13:12

    Yeah, unfortunately it doesn't. I also was disappointed when realize that after digging sources.

    But here is other (good) side of this fact: if your program uses boost::asio, you may wrap POSIX message queues API as just another datagram data source and this (IMHO) would be even better to use if it were a part of boost::interprocess... it would be quite non trivial, but (IMHO) definitely deserves this, so you may work w/ MQ in a unified way and use power of other boost::asio stuff...

    ... in my next project if I would need POSIX MQ again, I'll definitely take this way :)

    0 讨论(0)
提交回复
热议问题