MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / GetTerminationEventHandle

Function GetTerminationEventHandle

main/MiNiFiWindowsService.cpp:246–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246HANDLE GetTerminationEventHandle(bool* isStartedByService) {
247 *isStartedByService = true;
248 HANDLE hEvent = CreateEvent(0, TRUE, FALSE, SERVICE_TERMINATION_EVENT_NAME);
249 if (!hEvent) {
250 return nullptr;
251 }
252
253 if (GetLastError() != ERROR_ALREADY_EXISTS) {
254 *isStartedByService = false;
255 }
256
257 return hEvent;
258}
259
260bool CreateServiceTerminationThread(std::shared_ptr<logging::Logger> logger, HANDLE terminationEventHandle) {
261 // Get hService and monitor it - if service is terminated, then terminate current exe, otherwise the exe becomes unmanageable when service is restarted.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected