diff --git a/telldus-core/common/EventHandler.h b/telldus-core/common/EventHandler.h index abca38c0..620d370e 100644 --- a/telldus-core/common/EventHandler.h +++ b/telldus-core/common/EventHandler.h @@ -7,6 +7,11 @@ #ifndef TELLDUS_CORE_COMMON_EVENTHANDLER_H_ #define TELLDUS_CORE_COMMON_EVENTHANDLER_H_ +#ifdef _MSC_VER +typedef unsigned __int64 uint64_t; +#else +#include +#endif #include "common/Event.h" namespace TelldusCore { @@ -27,9 +32,6 @@ namespace TelldusCore { class PrivateData; PrivateData *d; bool listIsSignalled(); -#ifndef _WINDOWS - bool isSignalled(); -#endif friend class Event; }; } diff --git a/telldus-core/common/EventHandler_unix.cpp b/telldus-core/common/EventHandler_unix.cpp index a5be1b17..6c65339c 100644 --- a/telldus-core/common/EventHandler_unix.cpp +++ b/telldus-core/common/EventHandler_unix.cpp @@ -53,10 +53,6 @@ EventRef EventHandler::addEvent() { return event; } -bool EventHandler::isSignalled() { - return d->isSignalled; -} - bool EventHandler::listIsSignalled() { TelldusCore::MutexLocker locker(&d->listMutex); @@ -80,17 +76,17 @@ void EventHandler::signal(Event *event) { bool EventHandler::waitForAny() { pthread_mutex_lock(&d->mutex); int ret; - while(!isSignalled()) { + while (!d->isSignalled) { timeval now; gettimeofday(&now, NULL); - long int abstime_ns_large = now.tv_usec*1000 + 60000000000; //add 60 seconds wait (5 seconds before)? + uint64_t abstime_ns_large = now.tv_usec*1000 + 60000000000; // add 60 seconds wait (5 seconds before)? timespec abstime = { now.tv_sec + (abstime_ns_large / 1000000000), abstime_ns_large % 1000000000 }; ret = pthread_cond_timedwait(&d->event, &d->mutex, &abstime); - if (ret == ETIMEDOUT){ + if (ret == ETIMEDOUT) { continue; } } - if(!listIsSignalled()){ + if (!listIsSignalled()) { d->isSignalled = false; } pthread_mutex_unlock(&d->mutex);