diff options
author | Henrik Rentz-Reichert | 2016-11-21 20:38:10 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2016-11-21 20:38:10 +0000 |
commit | 0e349e78bdf554a49fc35739e2b1ecc865f4fe3e (patch) | |
tree | 84097ff984033a85e509a40b269bc7f7be93f4dc /plugins/org.eclipse.etrice.generator.c | |
parent | aaef21c8059b4b00d2088600fb77a6ebedf38fdf (diff) | |
download | org.eclipse.etrice-0e349e78bdf554a49fc35739e2b1ecc865f4fe3e.tar.gz org.eclipse.etrice-0e349e78bdf554a49fc35739e2b1ecc865f4fe3e.tar.xz org.eclipse.etrice-0e349e78bdf554a49fc35739e2b1ecc865f4fe3e.zip |
Bug 348173 - message services should be started according to thread prio
* generated code for creating and adding message services is sorted in descending priority
* runtimes changed to consider order
Change-Id: I5d2043fdbd8f4b9657b92e2f2cb7785b07849019
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c')
2 files changed, 16 insertions, 9 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend index 1e849d8c2..798959f4a 100644 --- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend +++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/NodeGen.xtend @@ -187,7 +187,7 @@ class NodeGen { etTime interval; /* initialization of all message services */ - «FOR thread: threads» + «FOR thread: threads.sortBy[-prio]» «IF thread.execmode==ExecMode::POLLED || thread.execmode==ExecMode::MIXED» interval.sec = «TimeConverter::split(thread.time, TimeConverter.SEC, true)»; interval.nSec = «TimeConverter::split(thread.time, TimeConverter.MILLI_SEC, false)»; @@ -212,7 +212,7 @@ class NodeGen { static void «clsname»_startMessageServices(void) { ET_MSC_LOGGER_SYNC_ENTRY("«clsname»", "startMessageServices") - «FOR thread: threads.sortBy[getPrio].reverse» + «FOR thread: threads.sortBy[-prio]» etMessageService_start(&msgService_«thread.name»); «ENDFOR» diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java index a945d3724..750650568 100644 --- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java +++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/NodeGen.java @@ -80,7 +80,6 @@ import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.Functions.Function1; import org.eclipse.xtext.xbase.lib.IntegerRange; import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.ListExtensions; @Singleton @SuppressWarnings("all") @@ -412,7 +411,15 @@ public class NodeGen { _builder.append("/* initialization of all message services */"); _builder.newLine(); { - for(final PhysicalThread thread : threads) { + final Function1<PhysicalThread, Long> _function_1 = new Function1<PhysicalThread, Long>() { + @Override + public Long apply(final PhysicalThread it) { + long _prio = it.getPrio(); + return Long.valueOf((-_prio)); + } + }; + List<PhysicalThread> _sortBy = IterableExtensions.<PhysicalThread, Long>sortBy(threads, _function_1); + for(final PhysicalThread thread : _sortBy) { { if ((Objects.equal(thread.getExecmode(), ExecMode.POLLED) || Objects.equal(thread.getExecmode(), ExecMode.MIXED))) { _builder.append("\t\t"); @@ -518,15 +525,15 @@ public class NodeGen { _builder.newLineIfNotEmpty(); _builder.newLine(); { - final Function1<PhysicalThread, Long> _function_1 = new Function1<PhysicalThread, Long>() { + final Function1<PhysicalThread, Long> _function_2 = new Function1<PhysicalThread, Long>() { @Override public Long apply(final PhysicalThread it) { - return Long.valueOf(it.getPrio()); + long _prio = it.getPrio(); + return Long.valueOf((-_prio)); } }; - List<PhysicalThread> _sortBy = IterableExtensions.<PhysicalThread, Long>sortBy(threads, _function_1); - List<PhysicalThread> _reverse = ListExtensions.<PhysicalThread>reverse(_sortBy); - for(final PhysicalThread thread_1 : _reverse) { + List<PhysicalThread> _sortBy_1 = IterableExtensions.<PhysicalThread, Long>sortBy(threads, _function_2); + for(final PhysicalThread thread_1 : _sortBy_1) { _builder.append("\t"); _builder.append("etMessageService_start(&msgService_"); String _name_11 = thread_1.getName(); |