Skip to content

Commit

Permalink
lestarch: fixing .start in UTs, docs, templates
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch committed Sep 2, 2021
1 parent ae37a92 commit 3f6a902
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void $(name)Init(void) {

void $(name)Start(void) {
// Active component startup
// start(identifier, priority, stack_size)
// start()
#for $startup_template in $component_startups:
${startup_template}
#end for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void construct$(name)Architecture(void) {
#else:
###
// Active component startup
// start(identifier, priority, stack_size)
// start()
#for $startup_template in $component_startups:
${startup_template}
#end for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,9 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
startup_template = """{name}_ptr->start();""".format(**component)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
**component
)
startup_template = """{name}.start();""".format(**component)
c.component_startups.append(startup_template)
#

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,9 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
startup_template = """{name}_ptr->start();""".format(**component)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
**component
)
startup_template = """{name}.start();""".format(**component)
c.component_startups.append(startup_template)
#

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,9 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
startup_template = """{name}_ptr->start();""".format(**component)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
**component
)
startup_template = """{name}.start();""".format(**component)
c.component_startups.append(startup_template)
#

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,9 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
startup_template = """{name}_ptr->start();""".format(**component)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
**component
)
startup_template = """{name}.start();""".format(**component)
c.component_startups.append(startup_template)
#

Expand Down
6 changes: 3 additions & 3 deletions Autocoders/Python/test/app1/DuckAppAcRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ void constructArchitecture(void) {

// Active component startup

// start(identifier, stack size, priority)
hueyComp_ptr->start(0, 10 * 1024, 100);
dueyComp_ptr->start(0, 10 * 1024, 100);
// start()
hueyComp_ptr->start();
dueyComp_ptr->start();

dumparch();
}
Expand Down
21 changes: 0 additions & 21 deletions Autocoders/Python/test/app1/ReadMe

This file was deleted.

46 changes: 0 additions & 46 deletions Autocoders/Python/test/app1/scons.log

This file was deleted.

6 changes: 3 additions & 3 deletions Autocoders/Python/test/app2/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void constructArchitecture(void) {

// Active component startup

// start(identifier, stack size, priority)
C1_ptr->start(0, 10 * 1024, 100);
C2_ptr->start(0, 10 * 1024, 100);
// start()
C1_ptr->start();
C2_ptr->start();

dumparch();

Expand Down
6 changes: 3 additions & 3 deletions Autocoders/Python/test/app2/test/ut/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void constructArchitecture(void) {

// Active component startup

// start(identifier, stack size, priority)
C1_ptr->start(0, 10 * 1024, 100);
C2_ptr->start(0, 10 * 1024, 100);
// start()
C1_ptr->start();
C2_ptr->start();

dumparch();

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/app4/app2AppAcRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ void constructArchitecture(void) {
hueyComp_ptr->setoutputPort2Msg1OutputPort(0, hub1Comp_ptr->getinputPort2SerializeInputPort(0));

// Active component startup
// start(identifier, stack size, priority)
hueyComp_ptr->start(0, 10 * 1024, 100);
// start()
hueyComp_ptr->start();
dumparch();
}

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/cnt_only/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int main(int argc, char* argv[]) {
constructArchitecture();

//Start Components
Huey_ptr->start(0, 10 * 1024, 100);
Duey_ptr->start(0, 10 * 1024, 100);
Huey_ptr->start();
Duey_ptr->start();

// Ask for input to huey or duey here.
char in[80];
Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/cnt_only/test/ut/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ int main(int argc, char* argv[]) {
constructDuckArchitecture();

//Start Components
Huey.start(0, 10 * 1024, 100);
Duey.start(0, 10 * 1024, 100);
Huey.start();
Duey.start();

// Ask for input to huey or duey here.
char in[80];
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/test/command_string/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char* argv[]) {

TestCommand1Impl testImpl("TestCmdImpl");
testImpl.init(10);
testImpl.start(10,10*1024,100);
testImpl.start();
TestCommandSourceImpl cmdSrc("TestCmdSource");
cmdSrc.init();

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/partition/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void constructArchitecture(void) {
partitionComp_ptr->getoutputPort2SerializeOutputPort()->registerSerialPort(hueyComp_ptr->getinputPort3Msg3InputPort());

// Active component startup
// start(identifier, stack size, priority)
hueyComp_ptr->start(0, 10 * 1024, 100);
// start()
hueyComp_ptr->start();

dumparch();

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/passive/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ void constructArchitecture(void) {

// Active component startup

// start(identifier, stack size, priority)
C1_ptr->start(0, 10 * 1024, 100);
// start()
C1_ptr->start();

dumparch();
}
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/test/serial_passive/test/ut/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ int main(int argc, char* argv[]) {
serImpl.init(10,100);
ExampleComponents::ExampleComponentImpl exImpl("ExImpl");
exImpl.init();
serImpl.start(100,100,10*1024);
serImpl.start();

// connect ports
exImpl.set_exampleOutput_OutputPort(0,serImpl.get_SerialInSync_InputPort(0));
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/test/serialize_template/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) {
#endif

comp.init(10);
comp.start(10, 10 * 1024, 100);
comp.start();

AnotherExample::InputExamplePort* port = comp.getexampleInputExampleInputPort(0);

Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/test/serialize_user/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int argc, char* argv[]) {
#endif

comp.init(10);
comp.start(10, 10 * 1024, 100);
comp.start();

AnotherExample::InputExamplePort* port = comp.get_exampleInput_InputPort(0);

Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/test/stress/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) {
;
#endif
testImpl.init(10);
testImpl.start(10, 10 * 1024, 100);
testImpl.start();

TestCommandSourceImpl cmdSrc
#if FW_OBJECT_NAMES
Expand Down
2 changes: 1 addition & 1 deletion Drv/Ip/SocketReadTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void SocketReadTask::startSocketTask(const Fw::StringBase &name,
FW_ASSERT(not this->m_stop); // It is a coding error to stop the thread before it is started
m_reconnect = reconnect;
// Note: the first step is for the IP socket to open the the port
Os::Task::TaskStatus stat = m_task.start(name, SocketReadTask::readTask, this, priority, stack, cpuAffinity, 0);
Os::Task::TaskStatus stat = m_task.start(name, SocketReadTask::readTask, this, priority, stack, cpuAffinity);
FW_ASSERT(Os::Task::TASK_OK == stat, static_cast<NATIVE_INT_TYPE>(stat));
}

Expand Down
3 changes: 1 addition & 2 deletions Fw/Comp/ActiveComponentBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ namespace Fw {
static_cast<NATIVE_UINT_TYPE>(identifier));
}

void ActiveComponentBase::start(NATIVE_UINT_TYPE priority_in, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier) {
NATIVE_INT_TYPE priority = static_cast<NATIVE_INT_TYPE>(priority_in);
void ActiveComponentBase::start(NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier) {
Os::TaskString taskName;

#if FW_OBJECT_NAMES == 1
Expand Down
2 changes: 1 addition & 1 deletion Os/test/ut/OsTaskTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ void startTestTask(int iters) {
long localIter = iters;
testTask = new Os::Task();
Os::TaskString name("ATestTask");
Os::Task::TaskStatus stat = testTask->start(name,12,100,10*1024,someTask,(void*) localIter);
Os::Task::TaskStatus stat = testTask->start(name, someTask, (void*)localIter);
ASSERT_EQ(stat, Os::Task::TASK_OK);
}
2 changes: 1 addition & 1 deletion Utils/test/ut/LockGuardTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Utils {

{
LockGuard guard(data.mutex);
stat = testTask.start(name,12,100,10*1024,taskMethod,(void*) &data);
stat = testTask.start(name, taskMethod, (void*) &data);
ASSERT_EQ(stat, Os::Task::TASK_OK);
Os::Task::delay(100);
ASSERT_EQ(data.i, 0);
Expand Down
13 changes: 3 additions & 10 deletions docs/Tutorials/MathComponent/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1871,19 +1871,12 @@ The thread for the active `MathSender` component needs to be started:
`Ref/Top/Topology.cpp`, line 357:
```c++
pingRcvr.start(0, 100, 10*1024);
pingRcvr.start();
mathSender.start(0,100,10*1024);
mathSender.start();
```
The arguments to the `start()` function is as follows:
|Argument|Usage|
|---|---|
|1|Thread ID, unique value for each thread. Not used for Linux|
|2|Thread priority. Passed to underlying OS|
|3|Thread stack size. Passed to underlying OS|
The start call without arguments uses the Os defaults for priority, stack size, etc.
The `MathReceiver` queued component will execute on the thread of the 1Hz rate group, which will be shown later.
It does not need to to have a thread started, since queued components do not have threads.
Expand Down

0 comments on commit 3f6a902

Please sign in to comment.