Function hadean::hadean::init[][src]

pub fn init()
Expand description

Initialise the runtime for the current process and jump to the target function (in applicable).

Explanation

The target function refers to the function specified when the user calls spawn. Each process starts at the main function of the user application. It is expected that init gets called at the start of the application. On the root process, init returns and execution continues. On subsequent child processes, this function causes execution to jump to the target function.

The init function should ideally be the first function called inside the application. While it is technically possible to run some code before calling init, you cannot rely on any code being executed once the target function returns. Ensure that any object put on the stack prior to this point has been deallocated/destroyed. If setup/teardown is essential, consider using trampoline functions.

Panics

This function panics upon unsuccessful initialisation.