By having smartpointers, the function EventHandler::removeEvent() is obsolete
This commit is contained in:
parent
41c763cbd4
commit
93fa34545d
4 changed files with 2 additions and 16 deletions
|
@ -28,9 +28,6 @@ EventBase::EventBase(EventHandler *handler) {
|
|||
}
|
||||
|
||||
EventBase::~EventBase(void) {
|
||||
if (d->handler) {
|
||||
d->handler->removeEvent(this);
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ public:
|
|||
virtual ~EventHandler(void);
|
||||
|
||||
EventRef addEvent();
|
||||
bool removeEvent(EventBase *event);
|
||||
|
||||
bool waitForAny();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ EventHandler::~EventHandler(void) {
|
|||
|
||||
std::list<EventRef>::const_iterator it = d->eventList.begin();
|
||||
for(; it != d->eventList.end(); ++it) {
|
||||
//We clear the handler if someone else still has a reference to the event
|
||||
(*it)->clearHandler();
|
||||
}
|
||||
|
||||
|
@ -51,17 +52,6 @@ bool EventHandler::listIsSignalled(){
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EventHandler::removeEvent(EventBase *eventBase) {
|
||||
Event *event = reinterpret_cast<Event *>(eventBase);
|
||||
if (!event) {
|
||||
return false;
|
||||
}
|
||||
TelldusCore::MutexLocker locker(&d->listMutex);
|
||||
//TODO!
|
||||
//d->eventList.remove(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EventHandler::signal(Event *event) {
|
||||
pthread_mutex_lock(&d->mutex);
|
||||
//event->setSignaled();
|
||||
|
|
|
@ -88,7 +88,7 @@ void TelldusMain::start(void) {
|
|||
}
|
||||
}
|
||||
|
||||
if(handlerEvent->isSignaled()){
|
||||
if (handlerEvent->isSignaled()) {
|
||||
handlerEvent->popSignal();
|
||||
for ( std::list<ClientCommunicationHandler *>::iterator it = clientCommunicationHandlerList.begin(); it != clientCommunicationHandlerList.end(); ){
|
||||
if ((*it)->isDone()){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue