probably full of mistake
This commit is contained in:
parent
3ef80d2187
commit
820aff5af4
@ -42,9 +42,11 @@ const XFTimeout *XFBehavior::getCurrentTimeout() {
|
||||
}
|
||||
|
||||
void XFBehavior::setCurrentEvent(const XFEvent *pEvent) {
|
||||
|
||||
pCurrentEvent_ = pEvent;
|
||||
}
|
||||
|
||||
XFBehavior::TerminateBehavior XFBehavior::process(const XFEvent *pEvent) {
|
||||
|
||||
setCurrentEvent(pEvent);
|
||||
processEvent();
|
||||
return deleteOnTerminate_;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ XFDispatcher::~XFDispatcher() {
|
||||
}
|
||||
|
||||
void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const {
|
||||
|
||||
pEvent->getBehavior()->startBehavior();
|
||||
}
|
||||
|
||||
void XFDispatcher::pushEvent(XFEvent *pEvent) {
|
||||
@ -43,13 +43,11 @@ void XFDispatcher::pushEvent(XFEvent *pEvent) {
|
||||
}
|
||||
|
||||
void XFDispatcher::scheduleTimeout(int timeoutId, int interval, interface::XFBehavior *pBehavior) {
|
||||
XFTimeoutManager* timeoutManager = XFTimeoutManager::getInstance();
|
||||
timeoutManager->scheduleTimeout(timeoutId, interval, pBehavior);
|
||||
XFTimeoutManager::getInstance()->scheduleTimeout(timeoutId, interval, pBehavior);
|
||||
}
|
||||
|
||||
void XFDispatcher::unscheduleTimeout(int timeoutId, interface::XFBehavior *pBehavior) {
|
||||
XFTimeoutManager* timeoutManager = XFTimeoutManager::getInstance();
|
||||
timeoutManager->unscheduleTimeout(timeoutId, pBehavior);
|
||||
XFTimeoutManager::getInstance()->unscheduleTimeout(timeoutId, pBehavior);
|
||||
}
|
||||
|
||||
void XFDispatcher::executeOnce() {
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include "common/dispatcher.h"
|
||||
#include <config/xf-config.h>
|
||||
|
||||
#if (USE_XF_COMMON_TIMEOUTMANAGER_CLASS != 0)
|
||||
@ -20,21 +21,27 @@ interface::XFTimeoutManager * interface::XFTimeoutManager::getInstance() {
|
||||
return &timeoutManager;
|
||||
}
|
||||
|
||||
// TODO: Implement code for XFTimeoutManager class
|
||||
// TODO done: Implement code for XFTimeoutManager class
|
||||
|
||||
XFTimeoutManager::XFTimeoutManager() {
|
||||
}
|
||||
|
||||
XFTimeoutManager::~XFTimeoutManager() {
|
||||
|
||||
}
|
||||
|
||||
void XFTimeoutManager::addTimeout(XFTimeout *pNewTimeout) {
|
||||
pMutex_->lock();
|
||||
timeouts_.push_front(pNewTimeout);
|
||||
pMutex_->unlock();
|
||||
|
||||
}
|
||||
|
||||
void XFTimeoutManager::returnTimeout(XFTimeout *pTimeout) {
|
||||
pMutex_->lock();
|
||||
XFDispatcher::getInstance()->pushEvent(pTimeout);
|
||||
timeouts_.remove(pTimeout);
|
||||
}
|
||||
|
||||
XFTimeoutManager::~XFTimeoutManager() {
|
||||
|
||||
pMutex_->unlock();
|
||||
}
|
||||
|
||||
void XFTimeoutManager::start(std::function<void (uint32_t)> startTimeoutManagerTimer) {
|
||||
|
Reference in New Issue
Block a user