Fix Broker build error on gcc-4.6.
authorjyong2.kim <jyong2.kim@samsung.com>
Fri, 17 Jul 2015 07:49:54 +0000 (16:49 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 17 Jul 2015 08:20:21 +0000 (08:20 +0000)
arrange build script.
modify from std::atomic to boost::atomic.
resolve prevent.

Change-Id: I225a58721fe2de9926d226f9e46baff03b04cb52
Signed-off-by: jyong2.kim <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1710
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/resource-manipulation/src/resourceBroker/SConscript
service/resource-manipulation/src/resourceBroker/include/DevicePresence.h
service/resource-manipulation/src/resourceBroker/include/ResourceBroker.h
service/resource-manipulation/src/resourceBroker/include/ResourcePresence.h
service/resource-manipulation/src/resourceBroker/src/DevicePresence.cpp
service/resource-manipulation/src/resourceBroker/src/ResourcePresence.cpp

index 1cf3ae6..3043ba4 100755 (executable)
@@ -42,6 +42,7 @@ target_os = env.get('TARGET_OS')
 # Build flags
 ######################################################################
 resourcebroker_env.AppendUnique(CPPPATH = ['include'])
+resourcebroker_env.AppendUnique(CPPPATH = ['../../include'])
 resourcebroker_env.AppendUnique(CPPPATH = ['../common/primitiveResource/include'])
 resourcebroker_env.AppendUnique(CPPPATH = ['../common/expiryTimer/include'])
 resourcebroker_env.AppendUnique(CPPPATH = ['../common/expiryTimer/src'])
index 06a1a02..c792a4f 100755 (executable)
@@ -23,6 +23,7 @@
 
 #include <list>
 #include <string>
+#include <boost/atomic.hpp>
 
 #include "BrokerTypes.h"
 #include "ResourcePresence.h"
@@ -36,7 +37,7 @@ namespace OIC
         class DevicePresence
         {
         public:
-            using TimerID = long long;
+            typedef long long TimerID;
 
             DevicePresence();
             ~DevicePresence();
@@ -53,8 +54,8 @@ namespace OIC
             std::list<ResourcePresence * > resourcePresenceList;
 
             std::string address;
-            std::atomic<DEVICE_STATE> state;
-            std::atomic_bool isRunningTimeOut;
+            boost::atomic<DEVICE_STATE> state;
+            boost::atomic_bool isRunningTimeOut;
 
             std::mutex timeoutMutex;
             std::condition_variable condition;
index e05673c..5d9aad7 100755 (executable)
@@ -38,11 +38,11 @@ namespace OIC
         class ResourceBroker
         {
         public:
-            class InvalidParameterException: public PrimitiveException
+            class InvalidParameterException: public RCSException
             {
             public:
                 InvalidParameterException(std::string&& what)
-                : PrimitiveException{ std::move(what) } {}
+                : RCSException{ std::move(what) } {}
             };
             class FailedSubscribePresenceException: public PlatformException
             {
index 48b799c..f7ee6e0 100755 (executable)
@@ -24,7 +24,7 @@
 #include <functional>
 #include <list>
 #include <string>
-#include <atomic>
+#include <boost/atomic.hpp>
 #include <mutex>
 #include <condition_variable>
 
@@ -64,8 +64,8 @@ namespace OIC
             BROKER_MODE mode;
 
             bool isWithinTime;
-            std::atomic_bool isTimeoutCB;
-            std::atomic_long receivedTime;
+            boost::atomic_bool isTimeoutCB;
+            boost::atomic_long receivedTime;
             std::mutex cbMutex;
             std::condition_variable cbCondition;
             unsigned int timeoutHandle;
index 277f580..67b11d0 100755 (executable)
@@ -19,7 +19,7 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 #include "DevicePresence.h"
-#include "PrimitiveException.h"
+#include "RCSException.h"
 
 namespace OIC
 {
@@ -120,7 +120,8 @@ 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);
+                    OC_LOG_V(DEBUG, BROKER_TAG, "device state : %d",
+                            (int)(state.load(boost::memory_order_consume)));
                     changeAllPresenceMode(BROKER_MODE::DEVICE_PRESENCE_MODE);
                     presenceTimerHandle
                     = presenceTimer.postTimer(BROKER_DEVICE_PRESENCE_TIMEROUT, pTimeoutCB);
index 926eb4d..91f6a23 100755 (executable)
@@ -45,6 +45,7 @@ namespace OIC
             state = BROKER_STATE::REQUESTED;
             isWithinTime = true;
             mode = BROKER_MODE::NON_PRESENCE_MODE;
+            timeoutHandle = 0;
 
             requesterList = nullptr;
 
@@ -186,7 +187,7 @@ namespace OIC
             time(&currentTime);
             currentTime += 0L;
 
-            if((receivedTime.load(std::memory_order_relaxed) == 0) ||
+            if((receivedTime.load(boost::memory_order_consume) == 0) ||
               ((receivedTime + BROKER_SAFE_SECOND) > currentTime ))
             {
                 this->isWithinTime = false;