Remove codes related to the pthread tls
authorYoonchan Choi <yc81.choi@samsung.com>
Wed, 31 Jul 2013 11:47:04 +0000 (20:47 +0900)
committerYoonchan Choi <yc81.choi@samsung.com>
Wed, 31 Jul 2013 11:47:04 +0000 (20:47 +0900)
Change-Id: Id04c934d6d4137dc6718f404188e7490939ba048
Signed-off-by: Yoonchan Choi <yc81.choi@samsung.com>
src/FScl_AccountDbConnector.cpp
src/FScl_AccountDbConnector.h

index e3ad627..9855ab5 100644 (file)
@@ -28,8 +28,7 @@
 namespace Tizen { namespace Social
 {
 
-__thread bool isAccountDbConnected = false;
-pthread_key_t accountTlsKey = 0;
+bool _AccountDbConnector::__isAccountDbConnected = false;
 _AccountDbConnector* _AccountDbConnector::__pInstance = null;
 
 _AccountDbConnector::_AccountDbConnector(void)
@@ -40,27 +39,12 @@ _AccountDbConnector::~_AccountDbConnector(void)
 {
 }
 
-void
-_AccountDbConnector::OnThreadExit(void *pValue)
-{
-       _AccountDbConnector* pInstance = static_cast<_AccountDbConnector*>(pValue);
-
-       if (pInstance != null)
-       {
-               pInstance->Disconnect();
-       }
-
-       pthread_setspecific(accountTlsKey, null);
-}
-
 result
 _AccountDbConnector::Connect(void)
 {
        int ret = account_connect();
        SysTryReturnResult(NID_SCL, ret == ACCOUNT_ERROR_NONE, E_SYSTEM, "The method cannot proceed due to a severe system error.");
 
-       pthread_setspecific(accountTlsKey, this);
-
        return E_SUCCESS;
 }
 
@@ -76,7 +60,7 @@ _AccountDbConnector::Disconnect(void)
 result
 _AccountDbConnector::EnsureDbConnection(void)
 {
-       if (!isAccountDbConnected)
+       if (!__isAccountDbConnected)
        {
                _AccountDbConnector* pInstance = GetInstance();
                SysTryReturn(NID_SCL, pInstance != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
@@ -84,7 +68,7 @@ _AccountDbConnector::EnsureDbConnection(void)
                result r = pInstance->Connect();
                SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               isAccountDbConnected = true;
+               __isAccountDbConnected = true;
        }
 
        return E_SUCCESS;
@@ -98,8 +82,6 @@ _AccountDbConnector::InitAccountDbConnector(void)
 
        __pInstance = pInstance.release();
 
-       pthread_key_create(&accountTlsKey, OnThreadExit);
-
        std::atexit(DestroyAccountDbConnector);
 }
 
index 4da4e62..41d12b8 100644 (file)
@@ -34,8 +34,6 @@ public:
 
        static _AccountDbConnector* GetInstance(void);
 
-       static void OnThreadExit(void *pValue);
-
        result Connect(void);
 
        result Disconnect(void);
@@ -52,6 +50,7 @@ private:
 
 private:
        static _AccountDbConnector* __pInstance;
+       static bool __isAccountDbConnected;
        friend class std::default_delete< _AccountDbConnector >;
 };