Sierra Toolkit Version of the Day
|typedef void(*||FunctionPtr )()|
|Creates a new Bootstrap instance. |
|static void||bootstrap ()|
|Member function bootstrap runs through the stored bootstrap function pointers and executes each function. |
Class Bootstrap serves as a bootstrapping mechanism for products in the sierra toolkit and elsewhere.
Often, it is convenient to have a product perform registrations and other operations when linked into an application. One method of accomplishing this is to utilize a static object whose constructor perform these operations. However, static constructions are executed prior to main and in non-deterministc order. The later is particularly problematic if the constructor results in the usage of another static object which may not have been constructed yet.
So, the Bootstrap class creates a stack of callback functions that are executed, by main(), when Bootstrap::bootstrap() is called. These functions are still executed in a non-deterministic order, but all static constructions have occurred.