23 HANDLE mNewWaitObject =
nullptr;
24 std::function<void()> mCallback;
29 if (mNewWaitObject !=
nullptr) {
30 auto r = UnregisterWaitEx(mNewWaitObject, INVALID_HANDLE_VALUE);
35 void registerWaitForSingleObject(HANDLE baseHandle, std::function<
void()> callback, DWORD timeout = INFINITE, DWORD flags = WT_EXECUTEDEFAULT)
noexcept {
36 AUI_ASSERTX(mNewWaitObject ==
nullptr,
"waitForExitCode object already registered");
38 mCallback = std::move(callback);
40 auto r = RegisterWaitForSingleObject(&mNewWaitObject, baseHandle, [](PVOID context, BOOLEAN){
43 },
this, timeout, flags);
Encapsulates calls to RegisterWaitForSingleObject/UnregisterWait.
Definition: AWin32EventWait.h:21
#define AUI_ASSERT(condition)
Asserts that the passed condition evaluates to true.
Definition: Assert.h:55
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition: Assert.h:74
Forbids copy of your class.
Definition: values.h:40