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>
# 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'])
#include <list>
#include <string>
+#include <boost/atomic.hpp>
#include "BrokerTypes.h"
#include "ResourcePresence.h"
class DevicePresence
{
public:
- using TimerID = long long;
+ typedef long long TimerID;
DevicePresence();
~DevicePresence();
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;
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
{
#include <functional>
#include <list>
#include <string>
-#include <atomic>
+#include <boost/atomic.hpp>
#include <mutex>
#include <condition_variable>
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;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include "DevicePresence.h"
-#include "PrimitiveException.h"
+#include "RCSException.h"
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);
state = BROKER_STATE::REQUESTED;
isWithinTime = true;
mode = BROKER_MODE::NON_PRESENCE_MODE;
+ timeoutHandle = 0;
requesterList = nullptr;
time(¤tTime);
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;