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

Function StopControl

RedEdrPplService/control.cpp:122–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120
121
122void StopControl() {
123 LOG_W(LOG_INFO, L"Control: Stop Thread");
124
125 // Signal the thread to stop
126 keep_running = FALSE;
127
128 // Send empty data to unblock any pending pipe operations
129 pipeServer.Send((char*)"");
130
131 // Wait for the thread to finish (with timeout)
132 if (control_thread != NULL) {
133 DWORD waitResult = WaitForSingleObject(control_thread, 5000); // 5 second timeout
134 if (waitResult == WAIT_TIMEOUT) {
135 LOG_W(LOG_ERROR, L"Control: Thread did not stop gracefully, terminating");
136 TerminateThread(control_thread, 1);
137 }
138 CloseHandle(control_thread);
139 control_thread = NULL;
140 }
141}
142
143
144//////

Callers 1

ShutdownServiceFunction · 0.85

Calls 2

SendMethod · 0.80
LOG_WFunction · 0.70

Tested by

no test coverage detected