mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
Diff: source/ThreadedResourceObserver.cpp
- Revision:
- 34:a10d65907549
- Parent:
- 31:2507e64fcc42
- Child:
- 54:dfee8691c83a
--- a/source/ThreadedResourceObserver.cpp Tue Jun 14 19:29:30 2016 +0000 +++ b/source/ThreadedResourceObserver.cpp Tue Jun 14 19:42:15 2016 +0000 @@ -23,12 +23,12 @@ // Class support #include "mbed-connector-interface/ThreadedResourceObserver.h" + #ifdef CONNECTOR_USING_THREADS + // constructor ThreadedResourceObserver::ThreadedResourceObserver(DynamicResource *resource,int sleep_time) : ResourceObserver(resource,sleep_time) - #ifdef CONNECTOR_USING_THREADS ,m_observation_thread(&ThreadedResourceObserver::_observation_notifier,this) - #endif { this->setObserving(false); // DEBUG @@ -38,14 +38,11 @@ // destructor ThreadedResourceObserver::~ThreadedResourceObserver() { this->stopObservation(); - #ifdef CONNECTOR_USING_THREADS this->m_observation_thread.terminate(); - #endif } // notifier void ThreadedResourceObserver::_observation_notifier(void const *instance) { - #ifdef CONNECTOR_USING_THREADS ThreadedResourceObserver *me = (ThreadedResourceObserver *)instance; while(true) { Thread::wait(me->getSleepTime()); @@ -53,7 +50,6 @@ me->getResource()->observe(); } } - #endif } // begin observing... @@ -64,4 +60,6 @@ // stop observing... void ThreadedResourceObserver::stopObservation() { this->setObserving(false); - } \ No newline at end of file + } + + #endif // CONNECTOR_USING_THREADS \ No newline at end of file