c++ - Boost Message Queues 是文件级持久化吗?

标签 c++ c++11 boost

Boost Message Queues 是文件级持久化吗?

在 boost IPC 文档中提到消息队列是文件或内核级持久性。

http://www.boost.org/doc/libs/1_38_0/doc/html/interprocess/some_basic_explanations.html

所以我的问题是,它们的文件级持久性是否意味着可以在重启后继续存在,或者如果我们也重启,是否会在内存中持续存在。

如果默认情况下它们是内核级持久性,我们如何才能使它们成为文件级持久性?

编辑:当我注销我的系统并再次登录时,队列在那里并且工作正常但是当我重新启动系统时队列已被删除,我正在使用 Ubunutu 并想实现一个队列可以在服务器崩溃后幸存下来我该怎么做?

最佳答案

正如文档所解释的那样,区别取决于实现。

有些平台会有内核支持(因此,共享 IPC 对象的“内核级持久性”),有些则不会:

As you can see, Boost.Interprocess defines some mechanisms with "Kernel or Filesystem" persistence. This is because POSIX allows this possibility to native interprocess communication implementations. One could, for example, implement shared memory using memory mapped files and obtain filesystem persistence (for example, there is no proper known way to emulate kernel persistence with a user library for Windows shared memory using native shared memory, or process persistence for POSIX shared memory, so the only portable way is to define "Kernel or Filesystem" persistence).

不是您可以随意切换的东西。

此外,它可能不是您所追求的(持久性与对象的生命周期有关,与消息无关,AFAICT)

关于c++ - Boost Message Queues 是文件级持久化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24645509/

相关文章:

java - C++等价于Java this

c++ - 谁能帮我解释一下C++中typedef的用法?

c++ - 复制在标准 vector 中只出现一次的元素的最有效方法是什么?

c++ - 如何强制编译 Boost 以使用 -fPIC

c++ - 局部变量的相对内存位置

具有接收/发送命令和请求/响应设计的 C++ 服务器

c++ - clang osx march=native 没有优化的大约 1/3rd 速度

c++ - C++11 中成员函数的值类别属性是什么?

c++ - 如何在 boost 程序选项中有一个可选的选项值?

c++ - 如何从 boost::ptr_vector 中删除 "this"