summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwangbok Kim <gwangbok.kim@samsung.com>2013-04-15 14:09:30 +0900
committerGwangbok Kim <gwangbok.kim@samsung.com>2013-04-15 14:10:09 +0900
commitb716dcd3d3fc8ce96fc84cba786f146e96d8d443 (patch)
tree5e1fa7feced468cd7772673dcbad8c1dc81ec5f4
parentd57e6b77d36f6d7fac2176d748a6394f8885ea55 (diff)
downloadsocial-b716dcd3d3fc8ce96fc84cba786f146e96d8d443.tar.gz
social-b716dcd3d3fc8ce96fc84cba786f146e96d8d443.tar.bz2
social-b716dcd3d3fc8ce96fc84cba786f146e96d8d443.zip
fix code for N_SE-34155
Change-Id: I84659bc8ab00648730ce85bc00ae37ee194bc733 Signed-off-by: Gwangbok Kim <gwangbok.kim@samsung.com>
-rw-r--r--src/FScl_ContactDbConnector.cpp24
-rw-r--r--src/FScl_ContactDbConnector.h3
2 files changed, 4 insertions, 23 deletions
diff --git a/src/FScl_ContactDbConnector.cpp b/src/FScl_ContactDbConnector.cpp
index e5978a9..db664ef 100644
--- a/src/FScl_ContactDbConnector.cpp
+++ b/src/FScl_ContactDbConnector.cpp
@@ -30,8 +30,7 @@
namespace Tizen { namespace Social
{
-__thread bool isConnected = false;
-pthread_key_t tlsKey = 0;
+bool _ContactDbConnector::__isConnected = false;
_ContactDbConnector* _ContactDbConnector::__pInstance = null;
_ContactDbConnector::_ContactDbConnector(void)
@@ -42,19 +41,6 @@ _ContactDbConnector::~_ContactDbConnector(void)
{
}
-void
-_ContactDbConnector::OnThreadExit(void *pValue)
-{
- _ContactDbConnector* pInstance = static_cast<_ContactDbConnector*>(pValue);
-
- if (pInstance != null)
- {
- pInstance->Disconnect();
- }
-
- pthread_setspecific(tlsKey, NULL);
-}
-
result
_ContactDbConnector::Connect(void)
{
@@ -71,8 +57,6 @@ _ContactDbConnector::Connect(void)
SysTryReturn(NID_SCL, ret != CONTACTS_ERROR_IPC_NOT_AVALIABLE, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred. Contact server is not available. Elapsed time : %lld", GetErrorMessage(E_SYSTEM), endTicks - startTicks);
SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
- pthread_setspecific(tlsKey, this);
-
return E_SUCCESS;
}
@@ -89,7 +73,7 @@ _ContactDbConnector::Disconnect(void)
result
_ContactDbConnector::EnsureDbConnection(void)
{
- if (!isConnected)
+ if (!__isConnected)
{
_ContactDbConnector* pInstance = GetInstance();
SysTryReturn(NID_SCL, pInstance != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
@@ -97,7 +81,7 @@ _ContactDbConnector::EnsureDbConnection(void)
result r = pInstance->Connect();
SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
- isConnected = true;
+ __isConnected = true;
}
return E_SUCCESS;
@@ -111,8 +95,6 @@ _ContactDbConnector::InitContactDbConnector(void)
__pInstance = pInstance.release();
- pthread_key_create(&tlsKey, OnThreadExit);
-
std::atexit(DestroyContactDbConnector);
}
diff --git a/src/FScl_ContactDbConnector.h b/src/FScl_ContactDbConnector.h
index afeb5b6..cc28c53 100644
--- a/src/FScl_ContactDbConnector.h
+++ b/src/FScl_ContactDbConnector.h
@@ -35,8 +35,6 @@ public:
static _ContactDbConnector* GetInstance(void);
- static void OnThreadExit(void *pValue);
-
result Connect(void);
result Disconnect(void);
@@ -53,6 +51,7 @@ private:
private:
static _ContactDbConnector* __pInstance;
+ static bool __isConnected;
friend class std::default_delete< _ContactDbConnector >;
};