MCPcopy Create free account
hub / github.com/dobin/RedEdr / PplReaderShutdown

Function PplReaderShutdown

RedEdr/pplreader.cpp:132–164  ·  view source on GitHub ↗

Shutdown

Source from the content-addressed store, hash-verified

130
131// Shutdown
132void PplReaderShutdown() {
133 LOG_A(LOG_INFO, "PPLReader: Shutdown");
134
135 // Signal stop
136 if (hStopEventPpl != NULL) {
137 SetEvent(hStopEventPpl);
138 }
139
140 // Cancel any blocking I/O (ReceiveBatch or ConnectNamedPipe) on the worker thread
141 if (hPplThreadHandle != NULL) {
142 CancelSynchronousIo(hPplThreadHandle);
143 }
144
145 // Wait for thread to exit cleanly
146 if (hPplThreadHandle != NULL) {
147 if (WaitForSingleObject(hPplThreadHandle, 5000) == WAIT_TIMEOUT) {
148 LOG_A(LOG_WARNING, "PplReader: Thread did not exit in time, force-terminating");
149 TerminateThread(hPplThreadHandle, 1);
150 }
151 CloseHandle(hPplThreadHandle);
152 hPplThreadHandle = NULL;
153 }
154
155 // Close event handles
156 if (hStopEventPpl != NULL) {
157 CloseHandle(hStopEventPpl);
158 hStopEventPpl = NULL;
159 }
160 if (threadReadynessPpl != NULL) {
161 CloseHandle(threadReadynessPpl);
162 threadReadynessPpl = NULL;
163 }
164}

Callers 1

ManagerShutdownFunction · 0.85

Calls 1

LOG_AFunction · 0.70

Tested by

no test coverage detected