From 9eef94e868f8574e6d8f368355964f3259c96f45 Mon Sep 17 00:00:00 2001 From: Rami Jung Date: Wed, 12 Aug 2015 17:38:36 +0900 Subject: [PATCH] [Resource Encapsulation] removing "boost/atomic.hpp" from DevicePressence.h That was removed because Tizen 2.3 uses boost 1.51 which doesn't have "boost/atomic.hpp" Instead of boost::atomic, std::atomic has been applied and related modules have been changed - DevicePresence::getDeviceState() from DevicePresence.cpp - Definition of DEVICE_STATE from BrokerTypes.h - the way to print log from DevicePresence::subscribeCB() boost::memory_order_consume vanished Change-Id: I9403a19c9f52d0059cb60d6bff113f5608464753 Signed-off-by: Rami Jung Reviewed-on: https://gerrit.iotivity.org/gerrit/2180 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../resource-encapsulation/src/resourceBroker/include/BrokerTypes.h | 2 +- .../src/resourceBroker/include/DevicePresence.h | 4 ++-- .../resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h b/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h index 8ef780f..b974da0 100644 --- a/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h +++ b/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h @@ -64,7 +64,7 @@ namespace OIC * REQUESTED - It means that broker receives the request for presence checking * LOST_SIGNAL - In case that 'subscribeCB' function receives the message except 'OK' */ - enum class DEVICE_STATE + enum DEVICE_STATE { ALIVE = 0, REQUESTED, diff --git a/service/resource-encapsulation/src/resourceBroker/include/DevicePresence.h b/service/resource-encapsulation/src/resourceBroker/include/DevicePresence.h index a964e65..648b46d 100644 --- a/service/resource-encapsulation/src/resourceBroker/include/DevicePresence.h +++ b/service/resource-encapsulation/src/resourceBroker/include/DevicePresence.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include "BrokerTypes.h" #include "ResourcePresence.h" @@ -54,7 +54,7 @@ namespace OIC std::list resourcePresenceList; std::string address; - boost::atomic state; + std::atomic_int state; boost::atomic_bool isRunningTimeOut; std::mutex timeoutMutex; diff --git a/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp b/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp index 629ef14..f338979 100644 --- a/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp +++ b/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp @@ -71,7 +71,8 @@ namespace OIC } DEVICE_STATE DevicePresence::getDeviceState() const { - return state; + int ret=state; + return (DEVICE_STATE)ret; } const std::string DevicePresence::getAddress() const { @@ -132,7 +133,7 @@ namespace OIC OC_LOG_V(DEBUG, BROKER_TAG, "SEQ# %d",seq); state = DEVICE_STATE::ALIVE; OC_LOG_V(DEBUG, BROKER_TAG, "device state : %d", - (int)(state.load(boost::memory_order_consume))); + (int)getDeviceState()); changeAllPresenceMode(BROKER_MODE::DEVICE_PRESENCE_MODE); presenceTimerHandle = presenceTimer.post(BROKER_DEVICE_PRESENCE_TIMEROUT, pTimeoutCB); -- 2.7.4