1372 use temporary job pointer instead of modifying curr_job in exec_set_time_tic_value

* add integration test sim SIM_exec_set_time_tic_value
* use temporary job pointer instead of modifying curr_job in exec_set_time_tic_value
closes #1372
This commit is contained in:
Scott Fennell 2022-10-28 17:19:54 -05:00 committed by GitHub
parent 63e9c32416
commit d0511e8fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 3 deletions

View File

@ -207,7 +207,7 @@ namespace Trick {
/** Queue to hold unfreeze jobs.\n */
Trick::ScheduledJobQueue unfreeze_queue ; /**< trick_io(**) */
/** Queue to hold unfreeze jobs.\n */
/** Queue to hold time_tic_changed jobs.\n */
Trick::ScheduledJobQueue time_tic_changed_queue ; /**< trick_io(**) */
/** Enough threads to accomodate the number of children specified in the S_define file.\n */

View File

@ -0,0 +1,4 @@
trick.stop(1.0);
trick.exec_set_time_tic_value(10000000)

View File

@ -0,0 +1,21 @@
/************************TRICK HEADER*************************
PURPOSE:
()
LIBRARY DEPENDENCIES:
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
##include "ttvtest.h"
class TTVTestSimObject : public Trick::SimObject {
public:
TTVTest ttvtest;
TTVTestSimObject() {
(0.0078125, "scheduled") trick_ret = ttvtest.scheduled();
}
};
TTVTestSimObject ttvtestSimObject;

View File

@ -0,0 +1,3 @@
TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models

View File

@ -0,0 +1,6 @@
#include <cstdio>
#include "ttvtest.h"
int TTVTest::scheduled() {
//message_publish(MSG_NORMAL, "Hello World!\n");
return 0;
}

View File

@ -0,0 +1,12 @@
/*************************************************************************
PURPOSE: (Starter class)
LIBRARY DEPENDENCY:
(
(ttvtest.cpp)
)
**************************************************************************/
class TTVTest {
public:
int scheduled();
};

View File

@ -25,6 +25,7 @@ SIMS_TO_COMPILE_ONLY = \
SIMS_TO_COMPILE_AND_RUN = \
SIM_demo_sdefine \
SIM_events \
SIM_exec_set_time_tic_value \
SIM_python_namespace \
SIM_rti \
SIM_stls \

View File

@ -50,8 +50,10 @@ int Trick::Executive::set_time_tic_value(int in_tics) {
/* call jobs for other objects that need to know the time_tic changed. */
time_tic_changed_queue.reset_curr_index() ;
while ( (curr_job = time_tic_changed_queue.get_next_job()) != NULL ) {
ret = curr_job->call() ;
/* job pointer for each job in time_tic_changed_queue */
JobData* next_job;
while ( (next_job = time_tic_changed_queue.get_next_job()) != NULL ) {
ret = next_job->call() ;
if ( ret != 0 ) {
message_publish(MSG_ERROR, "ERROR: time_tic_changed job: %s FAILED.\n", curr_job->name.c_str()) ;
return(ret) ;