Skip to content

Commit

Permalink
subscribe: Add comments to describe what WaitForSingleObject does
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
  • Loading branch information
cosmo0920 committed Mar 5, 2024
1 parent d8299fb commit f9f833d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/winevt/winevt_subscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ rb_winevt_subscribe_next(VALUE self)
return Qfalse;
}

/* If a signalEvent notifies a failure, raise
* SubscribeHandlerError to detect stale subscription.
* Note that we don't need to wait explicitly here.
* Because this function is inside of each enumerator.
* So, WaitForSingleObject should return immediately and should be
* processed with the latter each loop if there is no more items. */
dwWait = WaitForSingleObject(winevtSubscribe->signalEvent, 0);
if (dwWait == WAIT_FAILED) {
raise_system_error(rb_eSubscribeHandlerError, GetLastError());
Expand Down

0 comments on commit f9f833d

Please sign in to comment.