Don't start or wait for disabled threads in the executive #549

Added check to see if thread is enabled when starting it and waiting
for it to finish.  If it is disabled, skip it.
This commit is contained in:
Alex Lin 2018-01-23 09:35:06 -06:00
parent 6039669647
commit c4b872c26e
3 changed files with 28 additions and 24 deletions

View File

@ -42,6 +42,7 @@ int Trick::Executive::advance_sim_time() {
/* Adjust time_tics if one of the threads has a job or async cycle time less than the main thread's next job */
for (ii = 1; ii < threads.size() ; ii++) {
Threads * curr_thread = threads[ii] ;
if ( curr_thread->enabled ) {
if ( (curr_thread->process_type == PROCESS_TYPE_SCHEDULED) &&
(curr_thread->job_queue.get_next_job_call_time() < time_tics) ) {
time_tics = curr_thread->job_queue.get_next_job_call_time() ;
@ -52,6 +53,7 @@ int Trick::Executive::advance_sim_time() {
time_tics = curr_thread->amf_next_tics ;
}
}
}
/* Adjust time_tics to the terminate time if terminate is the next event */
if ( terminate_time < time_tics ) {

View File

@ -10,6 +10,7 @@
*/
bool Trick::Executive::isThreadReadyToRun( Trick::Threads * curr_thread , long long time_ticks) {
bool ret = false ;
if ( curr_thread->enabled ) {
switch ( curr_thread->process_type ) {
case Trick::PROCESS_TYPE_SCHEDULED:
ret = true ;
@ -31,6 +32,7 @@ bool Trick::Executive::isThreadReadyToRun( Trick::Threads * curr_thread , long l
}
break ;
}
}
return ret ;
}

View File

@ -16,7 +16,7 @@ int Trick::Executive::scheduled_thread_sync() {
/* 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) {
if ( curr_thread->enabled and curr_thread->process_type == PROCESS_TYPE_SCHEDULED) {
while (curr_thread->child_complete == false ) {
if (rt_nap == true) {
RELEASE();