便携式 C++ IPC(进程和共享内存)库,Boost vs ACE vs Poco?

发布于 2024-09-05 08:41:12 字数 288 浏览 3 评论 0原文

我需要一个可移植的 C++ 库来执行 IPC。到目前为止我一直使用 fork() 和 SysV 共享内存,但这限制了我只能使用 Linux/Unix。我发现有 3 个主要的 C++ 库提供了可移植的解决方案(包括 Windows 和 Mac OS X)。我真的很喜欢Boost,并且想使用它,但我需要流程,而且到目前为止这似乎只是一个实验分支!?我以前从未听说过 ACE 或 POCO,因此我陷入困境,不知道该选择哪一个。当然,我需要 fork()、sleep()(usleep() 会很棒)和共享内存。性能和文档也是重要的标准。

感谢您的帮助!

I need a portable C++ library for doing IPC. I used fork() and SysV shared memory until now but this limits me to Linux/Unix. I found out that there are 3 major C++ libraries that offer a portable solution (including Windows and Mac OS X). I really like Boost, and would like to use it but I need processes and it seems like that this is only an experimental branch until now!? I have never heard of ACE or POCO before and thus I am stuck I do not know which one to choose. I need fork(), sleep() (usleep() would be great) and shared memory of course. Performance and documentation are also important criteria.

Thanks, for your Help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谁人与我共长歌 2024-09-12 08:41:13

Boost Interprocess 从 Boost 1.35 就已经存在了(如果没记错的话,应该是 3 年前)。

ACE 的存在时间较长,但从实际情况来看,它可能有些过大了——ACE 是一个很大的库,而您似乎只需要其中包含的一小部分内容。这不一定是一个主要问题,但需要记住。特别是,真正为大型项目设计的库对于较小的项目来说可能看起来(或)有点笨拙。 ACE 也主要用于网络开发,包括 IPC,因为(例如)您可能希望从多个协作进程中构建看似单个服务器的东西,如果是这样,您显然需要一种方法来构建这些协作进程。

POCO 更像 ACE —— 它基本上是一个网络库,恰好包含一些 IPC 功能。同样,您正在考虑使用一个更大、更雄心勃勃的库中的一小部分。

根据你想要的,我可能会使用 Boost——它似乎最适合你所说的你想要的。 POCO 可能是我的第二选择。尽管它与 Boost 是分开的,但它似乎在很大程度上遵循相似的设计理念——特别是它旨在与标准库集成,而 ACE 往往更加包罗万象。

Boost Interprocess has been around since Boost 1.35 (which should be something like 3 years ago if memory serves).

ACE has been around longer, but from the sound of things, it's probably overkill -- ACE is a big library, and you only seem to want a tiny bit of what it includes. That's not necessarily a major problem, but it is something to keep in mind. In particular, a library that's really designed for big projects can tend to seem (or be) a bit clumsy for smaller ones. ACE is also intended primarily for network development, with IPC included because (for example) you might want to build what appears to be a single server out of a number of cooperating processes, and if so you obviously need a way to build those cooperating processes.

POCO is a lot more like ACE -- it's basically a network library that happens to include some IPC capability. Again, you're looking at using a pretty small part of a much larger, more ambitious library.

Based on what you want, I'd probably use Boost -- it seems to be the closest fit for what you've said you want. POCO would probably be my second choice. Although it's separate from Boost, it seems to largely follow similar design philosophy -- in particular it's meant to integrate with the standard library, where ACE tends to be more all-encompassing.

阳光①夏 2024-09-12 08:41:13

我喜欢添加 Apache 可移植运行时。它不是真正的 C++,但你当然可以使用它。标头甚至包含“extern“C””。

包括:

  • 共享内存
  • 网络连接
  • 信号
  • 互斥
  • 许多其他东西。

boost的问题在于它对c++编译器有很强的要求。特别是交叉编译器存在一个问题,例如强模板使用,因此纯 C 库“更可移植”。

I like to add the Apache portable runtime. It`s not really c++ but of course you can use it. The headers even has the "extern "C"" included.

Included is:

  • Shared Memory
  • Network connections
  • Signals
  • Mutexes
  • many other things.

The problem with boost is that it has strong requirements for the c++ compiler. Especially cross compilers have a problem with e.g. the strong template usage, so that a plain C library is "more portable".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文