[IOT-1592] Fix rd publish fail
authorJee Hyeok Kim <jihyeok13.kim@samsung.com>
Wed, 23 Nov 2016 08:51:41 +0000 (17:51 +0900)
committerJee Hyeok Kim <jihyeok13.kim@samsung.com>
Wed, 23 Nov 2016 11:57:30 +0000 (11:57 +0000)
1. RD publish fail due to lack of shared point lock logic.

https://jira.iotivity.org/browse/IOT-1592

Change-Id: I278b67ac050fb5bcb0cb5ee6920c27e446f0f01a
Signed-off-by: Jee Hyeok Kim <jihyeok13.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14647
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
resource/csdk/resource-directory/include/RDClient.h
resource/csdk/resource-directory/src/RDClient.cpp

index 288e985692b02e174bac0f51cac609d7c0b1b6b3..2f48e013113c113fd4d0161e43a843da1e183dd8 100644 (file)
@@ -46,9 +46,15 @@ class RDClient
 {
 private:
     OCQualityOfService m_qos;
+    std::shared_ptr<std::recursive_mutex> _csdkLock;
+    std::weak_ptr<std::recursive_mutex> m_csdkLock;
+
 public:
-    RDClient(OCQualityOfService qos = OC_NA_QOS) : m_qos(qos)
+    RDClient(OCQualityOfService qos = OC_NA_QOS)
+        : m_qos(qos),
+        _csdkLock{ std::make_shared<std::recursive_mutex>() }
     {
+        m_csdkLock = _csdkLock;
     }
 
     static RDClient& Instance()
index 365ab5d3b42db9fbec6257baa31088da21c0db82..115c451596b33d2f89a3116c0ac4cb2cc7551474 100644 (file)
@@ -33,8 +33,6 @@
 #include "OCException.h"
 #include "ocpayload.h"
 
-std::weak_ptr<std::recursive_mutex> m_csdkLock;
-
 using namespace OC;