next up previous contents
Next: Interrupt Service Routines Up: Overview Previous: Threads

The Main Thread-Initialization

When the processor starts, a reset handler executes the initial reset code (custom for the hardware) then calls the ucr_start() routine. This routine initializes the initialized data, clears the uninitialized data, prepares the main heap, and calls all the static initializers. All this setup, including calling static initializers, is done with interrupts globally disabled. Finally, interrupts are enabled and main() is called.

If main() returns, static destructors are called and ucr_start() returns. The implementation may choose what to do here. main() doesn't normally return anyhow so this behavior is often not important.



Stephen Williams
9/2/1997