From 08ad191f2e5cf761a2a5f6b9abb612a769c71c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Tue, 17 Oct 2023 15:52:38 +0200 Subject: [PATCH] all test done --- src/simplified/xf/port/common/dispatcher.cpp | 11 +++++++- .../xf/port/common/timeoutmanager.cpp | 3 ++- .../.settings/language.settings.xml | 27 +++++++++++++++++++ .../.settings/language.settings.xml | 27 +++++++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 test-bench/test4/ide-cubeide-test4-idf/.settings/language.settings.xml create mode 100644 test-bench/test5/ide-cubeide-test5-idf/.settings/language.settings.xml diff --git a/src/simplified/xf/port/common/dispatcher.cpp b/src/simplified/xf/port/common/dispatcher.cpp index 012cc9d..6f3481b 100644 --- a/src/simplified/xf/port/common/dispatcher.cpp +++ b/src/simplified/xf/port/common/dispatcher.cpp @@ -27,6 +27,7 @@ interface::XFDispatcher * interface::XFDispatcher::getInstance() { // TODO done: Implement code for XFDispatcher class XFDispatcher::XFDispatcher() { + this->pMutex_ = interface::XFMutex::create(); } XFDispatcher::~XFDispatcher() { @@ -47,7 +48,9 @@ void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const { void XFDispatcher::pushEvent(XFEvent *pEvent) { //Trace::out("[DEBUG] - Push Event"); + this->pMutex_->lock(); events_.push(pEvent, false); + this->pMutex_->unlock(); } void XFDispatcher::scheduleTimeout(int timeoutId, int interval, interface::XFBehavior *pBehavior) { @@ -60,13 +63,19 @@ void XFDispatcher::unscheduleTimeout(int timeoutId, interface::XFBehavior *pBeha void XFDispatcher::executeOnce() { if(!this->events_.empty()) { - dispatchEvent(this->events_.front()); + + this->pMutex_->lock(); + const XFEvent *ev = this->events_.front(); this->events_.pop(); + this->pMutex_->unlock(); + + dispatchEvent(ev); } } int XFDispatcher::execute(const void *param) { + (void) param; while(true){ this->executeOnce(); } diff --git a/src/simplified/xf/port/common/timeoutmanager.cpp b/src/simplified/xf/port/common/timeoutmanager.cpp index 9b31fa8..a796485 100644 --- a/src/simplified/xf/port/common/timeoutmanager.cpp +++ b/src/simplified/xf/port/common/timeoutmanager.cpp @@ -36,7 +36,7 @@ XFTimeoutManager::~XFTimeoutManager() { void XFTimeoutManager::addTimeout(XFTimeout *pNewTimeout) { this->pMutex_->lock(); - this->timeouts_.push_front(pNewTimeout); + this->timeouts_.push_back(pNewTimeout); this->pMutex_->unlock(); } @@ -89,6 +89,7 @@ void XFTimeoutManager::tick() { XFEvent* ev = *(it); XFDispatcher::getInstance()->pushEvent(ev); it = this->timeouts_.erase(it); + it--; } } this->pMutex_->unlock(); diff --git a/test-bench/test4/ide-cubeide-test4-idf/.settings/language.settings.xml b/test-bench/test4/ide-cubeide-test4-idf/.settings/language.settings.xml new file mode 100644 index 0000000..c7ea00f --- /dev/null +++ b/test-bench/test4/ide-cubeide-test4-idf/.settings/language.settings.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test-bench/test5/ide-cubeide-test5-idf/.settings/language.settings.xml b/test-bench/test5/ide-cubeide-test5-idf/.settings/language.settings.xml new file mode 100644 index 0000000..3d74852 --- /dev/null +++ b/test-bench/test5/ide-cubeide-test5-idf/.settings/language.settings.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file