mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
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:
parent
63e9c32416
commit
d0511e8fb9
@ -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 */
|
||||
|
4
test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py
Normal file
4
test/SIM_exec_set_time_tic_value/RUN_test/unit_test.py
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
trick.stop(1.0);
|
||||
trick.exec_set_time_tic_value(10000000)
|
21
test/SIM_exec_set_time_tic_value/S_define
Normal file
21
test/SIM_exec_set_time_tic_value/S_define
Normal 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;
|
3
test/SIM_exec_set_time_tic_value/S_overrides.mk
Normal file
3
test/SIM_exec_set_time_tic_value/S_overrides.mk
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
TRICK_CFLAGS += -I./models
|
||||
TRICK_CXXFLAGS += -I./models
|
6
test/SIM_exec_set_time_tic_value/models/ttvtest.cpp
Normal file
6
test/SIM_exec_set_time_tic_value/models/ttvtest.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <cstdio>
|
||||
#include "ttvtest.h"
|
||||
int TTVTest::scheduled() {
|
||||
//message_publish(MSG_NORMAL, "Hello World!\n");
|
||||
return 0;
|
||||
}
|
12
test/SIM_exec_set_time_tic_value/models/ttvtest.h
Normal file
12
test/SIM_exec_set_time_tic_value/models/ttvtest.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*************************************************************************
|
||||
PURPOSE: (Starter class)
|
||||
LIBRARY DEPENDENCY:
|
||||
(
|
||||
(ttvtest.cpp)
|
||||
)
|
||||
**************************************************************************/
|
||||
|
||||
class TTVTest {
|
||||
public:
|
||||
int scheduled();
|
||||
};
|
@ -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 \
|
||||
|
@ -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) ;
|
||||
|
Loading…
Reference in New Issue
Block a user