JITEvents are not checkpointable

JITEvents all need C bindings.  They need to be extern "C"ed if they are in C++.

Refs #53
This commit is contained in:
Alex Lin 2015-05-14 13:55:09 -05:00
parent 24fe5adaec
commit 83e68ef26e

View File

@ -11,43 +11,44 @@
//#define protected public
#include "../S_source.hh"
#include "sim_services/CheckPointRestart/include/CheckPointRestart_c_intf.hh"
extern "C" int run_event_1() {
message_publish(1, "event 1 fired!\n") ;
return 0 ;
}
int run_event_2() {
extern "C" int run_event_2() {
message_publish(1, "event 2 fired!\n") ;
return 0 ;
}
int run_event_3() {
extern "C" int run_event_3() {
message_publish(1, "event 3 fired!\n") ;
return 0 ;
}
int run_event_4() {
extern "C" int run_event_4() {
message_publish(1, "event 4 fired!\n") ;
return 0 ;
}
int run_event_before() {
extern "C" int run_event_before() {
message_publish(1, "event before fired!\n") ;
return 0 ;
}
int run_event_before2() {
extern "C" int run_event_before2() {
message_publish(1, "event before2 fired!\n") ;
return 0 ;
}
int run_event_after() {
extern "C" int run_event_after() {
message_publish(1, "event after fired!\n") ;
return 0 ;
}
int remove_events() {
extern "C" int remove_events() {
event_manager_remove_event(event_manager_get_event("event_3")) ;
event_manager_remove_event(event_manager_get_event("event_before")) ;
event_manager_remove_event(event_manager_get_event("event_after")) ;
@ -60,19 +61,23 @@ extern "C" int run_me() {
ball.obj.state.input.position[0] = 6.0 ;
ball.obj.state.input.position[1] = 6.0 ;
checkpoint_pre_init(true) ;
// add read events
jit_add_read( 90.0 , run_event_1 ) ;
jit_add_read( 80.0 , run_event_2 ) ;
jit_add_read( 90.0 , "run_event_1" ) ;
jit_add_read( 80.0 , "run_event_2" ) ;
// add cyclic event
jit_add_event( run_event_3 , "event_3" , 100.0 ) ;
jit_add_event( "run_event_3" , "event_3" , 100.0 ) ;
// events tied to jobs
jit_add_event_before( run_event_before , "event_before", "ball.obj.state_print" ) ;
jit_add_event_after( run_event_after, "event_after", "ball.obj.state_print" ) ;
jit_add_event_before( "run_event_before", "event_before", "ball.obj.state_print" ) ;
jit_add_event_after( "run_event_after", "event_after", "ball.obj.state_print" ) ;
// add a read event that removes all other events.
jit_add_read( 150.0 , remove_events ) ;
jit_add_read( 150.0 , "remove_events" ) ;
jit_add_read( 190.0 , "hidden_event" ) ;
exec_set_terminate_time(200.0) ;