是否存在类似于“CreateEvent()”的C ++跨平台命名事件。在Win32? [英] Is there a C++ cross platform "named event like the "CreateEvent()" in Win32?

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

问题描述

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



具体来说,这必须可以跨进程访问同一台机器。



我们已经在使用Poco的跨平台的东西,但我没有看到Poco ::事件是我想要的。



要解释我想做什么:



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



同样,这在win32中是微不足道的,但是如何跨平台。

解决方案

在C ++中没有内置的方式来执行命名事件。



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



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


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.

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.

EDIT:

To explain what I want to do:

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.

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

解决方案

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

You're looking for boost::condition and boost::named_condition

As you also mentioned there exists: Poco.NamedEvent

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

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