本文介绍了升压消息队列不是基于POSIX消息队列?无法选择(2)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想我会用Boost.Interprocess中的Message一台主机中的队列到位插座进行通信。但挖掘之后,似乎这个库由于某种原因避开了POSIX消息队列工具(这我的Linux系统支持),取而代之的是在POSIX共享内存的基础上实现。界面非常相似,你可能不猜测这马上,但它似乎是这样的。

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 reason eschews the POSIX message queue facility (which my Linux system supports), and instead is implemented on top of POSIX shared memory. The interface is similar enough that you might not guess this right away, but it seems to be the case.

对于我的缺点是,通过的shm_open获得共享内存(3)不似乎可用以选择(2),而不是通过 mq_open获得POSIX消息队列(3)

The downside for me is that shared memory obtained via shm_open(3) does not appear to be usable with select(2), as opposed to POSIX message queues obtained via mq_open(3).

好像Boost的图书馆在这种情况下输了。有谁知道知道为什么要这样?即使POSIX消息队列只在某些系统上可用,我期望加速使用该设备,在它是可用,并重新实现它只有在必要的。是否有对POSIX系统,我还不认识?

It seems like Boost's library loses in this case. Does anyone understand know why this should be? Even if it POSIX message queues are only available on some systems, I'd expect Boost to use that facility where it is available, and reimplement it only where necessary. Is there some pitfall of the POSIX system which I do not yet recognize?

推荐答案

使用Boost.Interprocess中同步类时,我遇到了类似的情况前些天:即条件类。它是在一个通用的方式实施,但它已经做的方式是使用自定义的自旋锁是的的低效(在OS X上至少)。对于所有意图和目的对其提出的同步类无用的。

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.

在我的经验,进程间图书馆是pretty不成熟。我用它来共享内存,以及它的工作pretty良好,但也有一些粗糙的边缘,我已经砍周围的一些缺失的功能,例如动态调整共享内存等。

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.

这篇关于升压消息队列不是基于POSIX消息队列?无法选择(2)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 22:48