The intended usage is to raise or lower the priority level with CSIM_SET_EVENT_PRIORITY just prior to scheduling a future event(s), and then to reset the priority level with CSIM_SET_EVENT_PRIORITY to the default value after scheduling. Future events are scheduled by the TRIGGER_THREAD, CALL_THREAD, and SCHEDULE_RESUME_WITH_PARAM functions.
Example usages would be to cause a certain event(s) to occur before or after any or all other events
that occur at a given time.
Example:
CSIM_SET_EVENT_PRIORITY( 20 ); TRIGGER_THREAD( collect_stats, dT, 0 ); TRIGGER_THREAD( collect_stats, dT + 1.0, 0 ); CSIM_SET_EVENT_PRIORITY( 10 );
int main( int argc, char *argv[] )
{
csim_initialize( argc, argv );
csim_main();
}
In such situations, CSIM's main routine can be renamed to old_main.
Then your other code can have its own main. However, before your models schedule any
events, your code should first call: