From 0212ed1650cf422d023d460f1291e58f32c9e12d Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 11 May 2018 09:49:17 -0500 Subject: [PATCH] #588 top_of_frame and _end_of_frame for child threads --- .../Executive/Executive_loop_multi_thread.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/trick_source/sim_services/Executive/Executive_loop_multi_thread.cpp b/trick_source/sim_services/Executive/Executive_loop_multi_thread.cpp index 51e42255..26cdc674 100644 --- a/trick_source/sim_services/Executive/Executive_loop_multi_thread.cpp +++ b/trick_source/sim_services/Executive/Executive_loop_multi_thread.cpp @@ -72,9 +72,28 @@ int Trick::Executive::loop_multi_thread() { exec_terminate_with_return(ret , curr_job->name.c_str() , 0 , "top_of_frame job did not return 0") ; } } + + for (ii = 1; ii < threads.size() ; ii++) { + + Trick::Threads * curr_thread = threads[ii]; + + if (curr_thread->process_type == Trick::PROCESS_TYPE_SCHEDULED) { + curr_thread->top_of_frame_queue.reset_curr_index() ; + while ( (curr_job = curr_thread->top_of_frame_queue.get_next_job()) != NULL ) { + ret = curr_job->call() ; + if ( ret != 0 ) { + exec_terminate_with_return(ret , curr_job->name.c_str() , 0 , "top_of_frame job did not return 0") ; + } + } + } + } + frame_count++ ; } + /* Loop through child threads calling their top of frame jobs */ + + /* Call thread sync jobs (wait for threads that are scheduled to finish by current time) */ thread_sync_queue.reset_curr_index() ; while ( (curr_job = thread_sync_queue.get_next_job()) != NULL ) { @@ -173,6 +192,21 @@ int Trick::Executive::loop_multi_thread() { exec_terminate_with_return(ret , curr_job->name.c_str() , 0 , "end_of_frame job did not return 0") ; } } + /* Loop through child threads calling their end of frame jobs */ + for (ii = 1; ii < threads.size() ; ii++) { + + Trick::Threads * curr_thread = threads[ii]; + + if (curr_thread->process_type == Trick::PROCESS_TYPE_SCHEDULED) { + curr_thread->end_of_frame_queue.reset_curr_index(); + while ( (curr_job = curr_thread->end_of_frame_queue.get_next_job()) != NULL ) { + ret = curr_job->call(); + if ( ret != 0 ) { + exec_terminate_with_return(ret , curr_job->name.c_str() , 0 , "end_of_frame job did not return 0"); + } + } + } + } next_frame_check_tics += software_frame_tics ; }