Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native C++ equivalent of ManualResetEvent from C#

What's the equivalent methodology of ManualResetEvent in native C++.

Although the below page gives some APIs for C++, it seems to be valid for C++\CLI, and Windows Runtime scenarios only.
http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent(v=vs.110).aspx

My Operating System is Windows 8 (x64). IDE: Visual Studio 2012. I am working on a Windows application which has three layers: C#, C++\CLI, and C++ native. I required this feature in C++ native.

Even though I currently need it only for Windows environment, it would be useful to know solution even for the Linux environment.

like image 908
Vishal Avatar asked Feb 27 '14 09:02

Vishal


People also ask

What is ManualResetEvent in C#?

AutoResetEvent and ManualResetEvent are used in threading and help us to manage synchronization using signals. For example, suppose there are 2 threads, Thread1 and Thread2 and 1 main thread created by the Main() method.

What is AutoResetEvent and how it is different from ManualResetEvent?

An AutoResetEvent resets when the code passes through event. WaitOne() , but a ManualResetEvent does not.


1 Answers

You can use CreateEvent to create an event object that you later signal with SetEvent and reset with ResetEvent. You can use a wait function to wait on an event object.

like image 112
Marius Bancila Avatar answered Sep 25 '22 14:09

Marius Bancila