Add Gateway terminate status

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2020-10-12 17:35:16 +09:00
parent 1f9241b260
commit 21f2f84219
5 changed files with 15 additions and 3 deletions

View File

@@ -307,7 +307,7 @@ void MultiTaskProcess::waitStop(void)
}
}
void MultiTaskProcess::threadStoped(void)
void MultiTaskProcess::threadStopped(void)
{
_mutex.lock();
_stopCount++;

View File

@@ -84,7 +84,7 @@ public:
int getParam(const char* parameter, char* value);
void run(void);
void waitStop(void);
void threadStoped(void);
void threadStopped(void);
void attach(Thread* thread);
private:

View File

@@ -38,6 +38,7 @@ Gateway::Gateway(void)
_clientList = new ClientList();
_adapterManager = new AdapterManager(this);
_topics = new Topics();
_stopFlg = false;
}
Gateway::~Gateway()
@@ -113,6 +114,7 @@ Gateway::~Gateway()
{
delete _topics;
}
WRITELOG("Gateway is deleted normally.\r\n");
}
int Gateway::getParam(const char* parameter, char* value)
@@ -309,10 +311,13 @@ void Gateway::run(void)
WRITELOG(" CertKey: %s\n", _params.certKey);
WRITELOG(" PrivateKey: %s\n\n\n", _params.privateKey);
_stopFlg = false;
/* Run Tasks until CTRL+C entred */
MultiTaskProcess::run();
_stopFlg = true;
/* stop Tasks */
Event* ev = new Event();
ev->setStop();
@@ -331,6 +336,11 @@ void Gateway::run(void)
_lightIndicator.allLightOff();
}
bool Gateway::IsStopping(void)
{
return _stopFlg;
}
EventQue* Gateway::getPacketEventQue()
{
return &_packetEventQue;

View File

@@ -199,6 +199,7 @@ public:
bool hasSecureConnection(void);
Topics* getTopics(void);
bool IsStopping(void);
private:
GatewayParams _params;
@@ -210,6 +211,7 @@ private:
SensorNetwork _sensorNetwork;
AdapterManager* _adapterManager {nullptr};
Topics* _topics;
bool _stopFlg;
};
}

View File

@@ -541,7 +541,7 @@ int Thread::start(void)
void Thread::stopProcess(void)
{
theMultiTaskProcess->threadStoped();
theMultiTaskProcess->threadStopped();
}
void Thread::stop(void)