Move the loop that waits for scheduled threads to finish out of advance_sim_time #292

Forgot to introduce the new function.
This commit is contained in:
Alex Lin 2016-08-26 09:10:44 -05:00
parent f5578c2e79
commit aeeaa7b3bc

View File

@ -0,0 +1,30 @@
#include <iostream>
#include "trick/Executive.hh"
#include "trick/release.h"
/**
@design
-# Loop through all threads.
-# Wait for thread to finish if the thread is PROCESS_TYPE_SCHEDULED
*/
int Trick::Executive::scheduled_thread_sync() {
unsigned int ii ;
/* Wait for synchronous threads to finish before testing for adjusting time_tics */
for (ii = 1; ii < threads.size() ; ii++) {
Threads * curr_thread = threads[ii] ;
if ( curr_thread->process_type == PROCESS_TYPE_SCHEDULED) {
while (curr_thread->child_complete == false ) {
if (rt_nap == true) {
RELEASE();
}
}
}
}
return 0 ;
}