2016-08-30 15:56:18 +00:00
|
|
|
|
|
|
|
#include "trick/Executive.hh"
|
|
|
|
|
|
|
|
/*
|
|
|
|
-# Switch on the type of thread
|
|
|
|
-# Scheduled threads are always ready to run
|
|
|
|
-# AMF thredas are ready to run if their previous frame just finished
|
|
|
|
-# ASYNC threads are ready to run if their complete flag is set and either they have
|
|
|
|
no cycle time or their previous frame just finished.
|
|
|
|
*/
|
2017-11-29 21:35:16 +00:00
|
|
|
bool Trick::Executive::isThreadReadyToRun( Trick::Threads * curr_thread , long long time_ticks) {
|
2016-08-30 15:56:18 +00:00
|
|
|
bool ret = false ;
|
2018-01-23 15:35:06 +00:00
|
|
|
if ( curr_thread->enabled ) {
|
|
|
|
switch ( curr_thread->process_type ) {
|
|
|
|
case Trick::PROCESS_TYPE_SCHEDULED:
|
2016-08-30 15:56:18 +00:00
|
|
|
ret = true ;
|
2018-01-23 15:35:06 +00:00
|
|
|
break ;
|
|
|
|
case Trick::PROCESS_TYPE_AMF_CHILD:
|
|
|
|
if ( curr_thread->amf_next_tics == time_ticks ) {
|
2016-08-30 15:56:18 +00:00
|
|
|
ret = true ;
|
2018-01-23 15:35:06 +00:00
|
|
|
}
|
|
|
|
break ;
|
|
|
|
case Trick::PROCESS_TYPE_ASYNC_CHILD:
|
|
|
|
if ( curr_thread->child_complete == true ) {
|
|
|
|
if (curr_thread->amf_cycle_tics == 0 ) {
|
2016-08-30 15:56:18 +00:00
|
|
|
ret = true ;
|
2018-01-23 15:35:06 +00:00
|
|
|
} else {
|
|
|
|
if ( curr_thread->amf_next_tics == time_ticks ) {
|
|
|
|
ret = true ;
|
|
|
|
}
|
2016-08-30 15:56:18 +00:00
|
|
|
}
|
|
|
|
}
|
2018-01-23 15:35:06 +00:00
|
|
|
break ;
|
|
|
|
}
|
2016-08-30 15:56:18 +00:00
|
|
|
}
|
|
|
|
return ret ;
|
|
|
|
}
|
|
|
|
|