| 364 | |
| 365 | |
| 366 | void StopWebServer() { |
| 367 | // Signal stop |
| 368 | if (hStopEventWeb != NULL) { |
| 369 | SetEvent(hStopEventWeb); |
| 370 | } |
| 371 | |
| 372 | svr.stop(); |
| 373 | |
| 374 | // Wait for thread to exit cleanly |
| 375 | if (webserver_thread != NULL) { |
| 376 | if (WaitForSingleObject(webserver_thread, 5000) == WAIT_TIMEOUT) { |
| 377 | LOG_A(LOG_WARNING, "WEB: Thread did not exit in time, force-terminating"); |
| 378 | TerminateThread(webserver_thread, 1); |
| 379 | } |
| 380 | // handle ownership stays with the threads vector; do not close here |
| 381 | } |
| 382 | |
| 383 | if (hStopEventWeb != NULL) { |
| 384 | CloseHandle(hStopEventWeb); |
| 385 | hStopEventWeb = NULL; |
| 386 | } |
| 387 | } |
| 388 |
no test coverage detected