是否有一个C ++跨平台“命名事件,如”CreateEvent()“在Win32? [英] Is there a C++ cross platform "named event like the "CreateEvent()" in Win32?

查看:159
本文介绍了是否有一个C ++跨平台“命名事件,如”CreateEvent()“在Win32?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Win32世界中寻找类似于CreateEvent(),SetEvent()和WaitForMultipleObjects()的东西。

I am looking for something analogous to CreateEvent(), SetEvent() and WaitForMultipleObjects() from the Win32 world.

具体而言,必须能够跨进程访问相同的机器。

Specifically this has to be accessible across processes on the same machine.

我们已经在使用Poco做一些跨平台的东西,但是我并没有看到Poco :: Event是我想要的。也许我错过了一些东西。

We are already using Poco for some cross platform stuff, but I don't see that the Poco::Event is what I want. perhaps i am missing something.

编辑:

解释我想做什么:

我想要进程B知道进程A中的某些事情。在win32中这是微不足道的 - 每个进程/线程调用具有事件名称的CreateEvent()。进程B在发生事件时调用waitForXObject()和进程A调用SetEvent()。 B发信号。

I want process B to know when something happens in process A. This is trivial in win32 - Each process/thread calls CreateEvent() with a name for the event. Process B calls waitForXObject() and Process A calls SetEvent() when something happens. B is signaled.

再次,这在win32中是微不足道的,但是如何做跨平台。

Again, this is trivial in win32, but how to do it cross-platform.

推荐答案

在C ++中没有内置的方式来命名事件。但是您可以使用boost来实现。

There is no built in way in C++ to do named events. But you can use boost to do it.

您正在寻找 boost :: condition boost :: named_condition

正如你也提到的那样存在: Poco.NamedEvent

As you also mentioned there exists: Poco.NamedEvent

这篇关于是否有一个C ++跨平台“命名事件,如”CreateEvent()“在Win32?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆