In the same way that changes of state are only recorded in the tracefile when a subsequent dump_state() statement is executed, changes to values of global parameters that occur during a simulation are only recorded in the tracefile when a subsequent dump_globals() statement is executed.
Global parameters can be accessed from the body of any entity, therefore extra care must be take to ensure that access is appropriately synchronized. HASE creates a mutual exclusion object for each global parameter with a name matching the original parameter name but affixed with _mutex. This object has two functions: Lock() and Unlock(). While inside a locked region of access (between Lock() and Unlock()) no other threads will be able to enter a region of code surrounded with a Lock() and Unlock() called on the same global parameter.
Below is a snippet of code from the body of an entity that may be invoked by several instances of that entity (executing as separate threads simultaneously). The .Lock() and .Unlock() calls ensure that the modification to the global parameter nodes_done is synchronised between the instances of the entity. dump_globals() is called after modification to record the change to nodes_done in the simulation tracefile.
nodes_done_mutex.Lock(); nodes_done++; dump_globals(); nodes_done_mutex.Unlock();