A system and method are provided for thread-safe initialization of static variables
in a multitasking system. In one embodiment, the static fields of a class may be
"virtualized" such that each application that utilizes the class has its own copy
of static fields. Each separate copy of the static fields is initialized only once.
Instructions for performing the initialization may be embedded in a class constructor.
The class constructor may be executed only once for each separate copy of the static
fields. A template class may be loaded for each separate copy of the static fields
when a copy of the static fields is sought to be initialized. The template class
may include a static initializer for one of the separate copies of the static fields.
The static initializer may be executed once for each separate copy of the static fields.