MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / CtrlHandler

Function CtrlHandler

ffmpeg-single-cmd/src/main/cpp/ffmpeg_mod.c:342–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340
341#if HAVE_SETCONSOLECTRLHANDLER
342static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
343{
344 av_log(NULL, AV_LOG_DEBUG, "\nReceived windows signal %ld\n", fdwCtrlType);
345
346 switch (fdwCtrlType)
347 {
348 case CTRL_C_EVENT:
349 case CTRL_BREAK_EVENT:
350 sigterm_handler(SIGINT);
351 return TRUE;
352
353 case CTRL_CLOSE_EVENT:
354 case CTRL_LOGOFF_EVENT:
355 case CTRL_SHUTDOWN_EVENT:
356 sigterm_handler(SIGTERM);
357 /* Basically, with these 3 events, when we return from this method the
358 process is hard terminated, so stall as long as we need to
359 to try and let the main thread(s) clean up and gracefully terminate
360 (we have at most 5 seconds, but should be done far before that). */
361 while (!ffmpeg_exited) {
362 Sleep(0);
363 }
364 return TRUE;
365
366 default:
367 av_log(NULL, AV_LOG_ERROR, "Received unknown windows signal %ld\n", fdwCtrlType);
368 return FALSE;
369 }
370}
371#endif
372
373void term_init(void)

Callers

nothing calls this directly

Calls 1

sigterm_handlerFunction · 0.85

Tested by

no test coverage detected