atexit.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include "defaults.h"
  3. using TAtExitFunc = void (*)(void*);
  4. using TTraditionalAtExitFunc = void (*)();
  5. void AtExit(TAtExitFunc func, void* ctx);
  6. void AtExit(TAtExitFunc func, void* ctx, size_t priority);
  7. void AtExit(TTraditionalAtExitFunc func);
  8. void AtExit(TTraditionalAtExitFunc func, size_t priority);
  9. bool ExitStarted();
  10. /**
  11. * Generally it's a bad idea to call this method except for some rare cases,
  12. * like graceful python DLL module unload.
  13. * This function is not threadsafe.
  14. * Calls in the moment when application is not terminating - bad idea.
  15. */
  16. void ManualRunAtExitFinalizers();
  17. /**
  18. * You shouldn't ever need this, unless you are writing some DLL modules,
  19. * which might get unloaded before application termination (nginx's modules, for example).
  20. * If a DLL sets exit handlers which belong to the DLL itself, these handlers point to
  21. * nowhere after the DLL has been unloaded, and an attempt to invoke any of those at the
  22. * application termination leads to a crash.
  23. */
  24. void DisableExitHandlers();