MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / _stdfunction ProcessSignal

Function _stdfunction ProcessSignal

Libraries/unrar/errhnd.cpp:263–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261extern "C"
262#endif
263void _stdfunction ProcessSignal(int SigType)
264#endif
265{
266#ifdef _WIN_ALL
267 // When a console application is run as a service, this allows the service
268 // to continue running after the user logs off.
269 if (SigType==CTRL_LOGOFF_EVENT)
270 return TRUE;
271#endif
272
273 ErrHandler.UserBreak=true;
274 ErrHandler.SetDisableShutdown();
275 mprintf(St(MBreak));
276
277#ifdef _WIN_ALL
278 // Let the main thread to handle 'throw' and destroy file objects.
279 for (uint I=0;!ErrHandler.MainExit && I<50;I++)
280 Sleep(100);
281#if defined(USE_RC) && !defined(SFX_MODULE) && !defined(RARDLL)
282 ExtRes.UnloadDLL();
283#endif
284 exit(RARX_USERBREAK);
285#endif
286
287#ifdef _UNIX
288 static uint BreakCount=0;
289 // User continues to press Ctrl+C, exit immediately without cleanup.
290 if (++BreakCount>1)
291 exit(RARX_USERBREAK);
292 // Otherwise return from signal handler and let Wait() function to close
293 // files and quit. We cannot use the same approach as in Windows,
294 // because Unix signal handler can block execution of our main code.
295#endif
296
297#if defined(_WIN_ALL) && !defined(_MSC_VER)
298 // Never reached, just to avoid a compiler warning
299 return TRUE;
300#endif
301}
302
303
304void ErrorHandler::SetSignalHandlers(bool Enable)

Callers

nothing calls this directly

Calls 3

StFunction · 0.85
SetDisableShutdownMethod · 0.80
mprintfFunction · 0.70

Tested by

no test coverage detected