| 161 | |
| 162 | #if HAVE_SETCONSOLECTRLHANDLER |
| 163 | static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) |
| 164 | { |
| 165 | av_log(NULL, AV_LOG_DEBUG, "\nReceived windows signal %ld\n", fdwCtrlType); |
| 166 | |
| 167 | switch (fdwCtrlType) |
| 168 | { |
| 169 | case CTRL_C_EVENT: |
| 170 | case CTRL_BREAK_EVENT: |
| 171 | sigterm_handler(SIGINT); |
| 172 | return TRUE; |
| 173 | |
| 174 | case CTRL_CLOSE_EVENT: |
| 175 | case CTRL_LOGOFF_EVENT: |
| 176 | case CTRL_SHUTDOWN_EVENT: |
| 177 | sigterm_handler(SIGTERM); |
| 178 | /* Basically, with these 3 events, when we return from this method the |
| 179 | process is hard terminated, so stall as long as we need to |
| 180 | to try and let the main thread(s) clean up and gracefully terminate |
| 181 | (we have at most 5 seconds, but should be done far before that). */ |
| 182 | while (!ffmpeg_exited) { |
| 183 | Sleep(0); |
| 184 | } |
| 185 | return TRUE; |
| 186 | |
| 187 | default: |
| 188 | av_log(NULL, AV_LOG_ERROR, "Received unknown windows signal %ld\n", fdwCtrlType); |
| 189 | return FALSE; |
| 190 | } |
| 191 | } |
| 192 | #endif |
| 193 | |
| 194 | #ifdef __linux__ |
nothing calls this directly
no test coverage detected