In the C ++ Windows platform, I want to execute a set of function calls as atomic so that the execution does not switch to other threads of my process. How should I do it? Any ideas, tips?
EDIT: I have a piece of code, for example:
someObject->Restart(); WaitForSingleObject(handle, INFINITE);
Now the Restart () function does its work asynchronously, so it returns quickly, and when this someObject is restarted, it sends me an event from another thread, where I signal the event descriptor on which I am waiting and, therefore, continue processing. But now the problem is that before the code reaches the WaitForSingleObject () part , I get a restart completion event, and I signal this event, and then WaitForSingleObject () never returns, since it is not signaled again. So I want to execute both Restart () and WaitForSingleObject () as atomic.
source share