trick/test/SIM_threads_simple/S_define
Alex Lin 0072e7d6f0 Unintended performance issue with integ_loop at end of scheduled job classes #243
Created a new executive job that waits for threads to finish and readies them
for their next frame of execution.  Created a new job class system_thread_sync
after the top of frame jobs and before the input processor is run to sync the
threads.  Along the way cleaned up instrumentation jobs on the threads to fix #290.
2016-08-24 10:55:27 -05:00

38 lines
927 B
Plaintext

#include "sim_objects/default_trick_sys.sm"
class testSimObject : public Trick::SimObject {
public:
int print_time (int thread) {
message_publish(1, "thread %d: time = %8.2f\n", thread, exec_get_sim_time()) ;
return 0 ;
} ;
/* This job takes longer than 0.1 seconds to run */
int slow_print_time (int thread) {
message_publish(1, "thread %d: time = %8.2f\n", thread, exec_get_sim_time()) ;
usleep(100000) ;
return 0 ;
} ;
testSimObject() {
(1.0, "scheduled") print_time(0) ;
C1 (0.5, "scheduled") print_time(1) ;
C2 (0.1, "scheduled") slow_print_time(2) ;
}
} ;
// Instantiations
testSimObject test ;
// Connect objects
void create_connections() {
// Set the default termination time
exec_set_terminate_time(30.0) ;
exec_set_freeze_frame(1.0) ;
}