Merge pull request #615 from nasa/framelog_fix

#588 top_of_frame and _end_of_frame fix for scheduled threads
This commit is contained in:
Alex Lin 2018-05-16 09:16:36 -05:00 committed by GitHub
commit a8314b1497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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