On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTTarget-32 Programming Manual
RTTarget-32 Reference Manual
Introduction
RTTarget-32 Configuration
Screen I/O
Interrupt Handling
Port I/O
System Functions
Function RTReboot
Function RTHalt
Function RTHaltCPL3
Function RTWait
Function RTLocateSection
Function RTSectionName
Function RTCallRing0
Function RTRaiseCPUException
Function RTSetTlsSlots
Function RTSetFlsSlots
Function RTCallDebugger
Function RTHandleInfo
Function RTSetExitHandler
Function RTSetFileApisTo
Function RTSetVersionExA
Function RTSetDLLNameTranslation
Program Loading
Memory Mapping and Management
Real-Time Clock and CMOS RAM
Keyboard
Mouse and Touch Screen Driver
Parallel Port Printer
Serial Port I/O
PCI BIOS
Plug-and-Play BIOS
PC Cards (PCMCIA)
MetaWINDOW Initialization
Run-Time System Support
System Management BIOS (SMBIOS)
Advanced Programmable Interrupt Controller (APIC)
Multiprocessor Management
Spinlocks
Advanced Configuration and Power Interface (ACPI) Tables
Extended RAM Management
RTVmf-32
RTRth-32
RTKernel-32
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Function RTSetExitHandler
Function RTSetExitHandler can be used to ensure that all atexit() handlers are called at program termination, even if the program is terminated with a direct call to Win32 API function TerminateProcess or ExitProcess:
void RTSetExitHandler(void (RTTAPI * Handler)(int ExitCode));
ParametersHandlerFunction to call when Win32 API function TerminateProcess or ExitProcess has been called. Typically, the address of run-time system function exit() should be used.
The recommended setup to ensure safe program termination or restart is:
- Install exit handlers using atexit() for all On Time RTOS-32 components which need to be shut down at program termination. For RTFiles-32, install RTFShutDown. For RTUSB-32, install RTUShutDown. For RTIP-32, install a custom exit handler which calls xn_interface_close for each opened interface (preferably interface option IO_HARD_CLOSE should be set for each interface).
- If your application contains custom software which programs devices to generate interrupts, install an exit handler with atexit() which programs the hardware to no longer generate interrupts.
- For applications using RTKernel-32, do not set kernel flag RF_NO_EXIT_TASK and do not call RTKInstallExitTask, RTCallDebugger(RT_DBG_CALLRESET, ...) or RTSetExitHandler.
- For applications not using RTKernel-32, call RTSetExitHandler(exit) and RTCallDebugger(RT_DBG_CALLRESET, (DWORD) exit, 0).
Function RTHandleInfo
Function RTSetFileApisTo
|