#588 top_of_frame and _end_of_frame for child threads

This commit is contained in:
anon 2018-05-11 09:49:17 -05:00
parent be6f9dc855
commit 0212ed1650

View File

@ -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 ;
}