summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-03-29 03:11:31 (EDT)
committertjung2012-03-29 03:11:31 (EDT)
commit236a921da297956e49b2cf80c60e01ad0b5e2ce1 (patch)
treeb58b2d3bb519ba9e68185a33481e0f482e7bc8f2
parentd210f660b2e7b5550471e2933bac8989718b4fbd (diff)
downloadorg.eclipse.etrice-236a921da297956e49b2cf80c60e01ad0b5e2ce1.zip
org.eclipse.etrice-236a921da297956e49b2cf80c60e01ad0b5e2ce1.tar.gz
org.eclipse.etrice-236a921da297956e49b2cf80c60e01ad0b5e2ce1.tar.bz2
[generator.c] shutdown implemented
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend
index cc76448..a425415 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.xtend
@@ -94,6 +94,8 @@ class SubSystemClassGen {
void «ssc.name»_stop(void); /* lifecycle stop */
void «ssc.name»_destroy(void); /* lifecycle destroy */
+ void «ssc.name»_shutdown(void); /* shutdown the dispatcher loop */
+
«helpers.userCode(ssc.userCode2)»
«generateIncludeGuardEnd(ssc.name)»
@@ -127,9 +129,10 @@ class SubSystemClassGen {
/* data for SubSysten «ssc.name» */
typedef struct «ssc.name» {
char *name;
+ volatile int shutdownRequest;
} «ssc.name»;
- static «ssc.name» «ssc.name»Inst = {"«ssc.name»"};
+ static «ssc.name» «ssc.name»Inst = {"«ssc.name»",0};
void «ssc.name»_initActorInstances(void);
void «ssc.name»_constructActorInstances(void);
@@ -160,7 +163,7 @@ class SubSystemClassGen {
ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "run")
#ifdef ET_RUNTIME_ENDLESS
- while(TRUE){
+ while(!(«ssc.name»Inst.shutdownRequest)){
if (etTimer_executeNeeded()){
etMessageService_execute(&msgService_Thread1);
«generateDatadrivenExecutes(root, ssi)»
@@ -168,7 +171,7 @@ class SubSystemClassGen {
}
#else
uint32 loopCounter = 0;
- while(TRUE){
+ while(!(«ssc.name»Inst.shutdownRequest)){
if (etTimer_executeNeeded()){
etMessageService_execute(&msgService_Thread1);
«generateDatadrivenExecutes(root, ssi)»
@@ -200,6 +203,14 @@ class SubSystemClassGen {
ET_MSC_LOGGER_SYNC_EXIT
}
+ void «ssc.name»_shutdown(void){
+ ET_MSC_LOGGER_SYNC_ENTRY("SubSys", "shutdown")
+ etLogger_logInfoF("%s_shutdown", «ssc.name»Inst.name);
+ «ssc.name»Inst.shutdownRequest = 1;
+ ET_MSC_LOGGER_SYNC_EXIT
+ }
+
+
void «ssc.name»_constructActorInstances(void){
ET_MSC_LOGGER_SYNC_ENTRY("«ssc.name»", "constructActorInstances")
«FOR ai : ssi.allContainedInstances»