_NetConnectionManagerImpl::InitSingleton(void)
{
result r = E_SUCCESS;
- static _NetConnectionManagerImpl instance;
- r = instance.Construct();
+ unique_ptr<_NetConnectionManagerImpl> pInstance(new (std::nothrow) _NetConnectionManagerImpl());
+ SysTryReturnVoidResult(NID_NET, pInstance != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = pInstance->Construct();
SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
ClearLastResult();
- __pInstance = &instance;
+
+ __pInstance = pInstance.release();
}
result
#include <pthread.h>
+#include <unique_ptr.h>
#include <FBaseSysLog.h>
#include <FBaseString.h>
#include <FNetNetTypes.h>
_NetIpcProxy::InitSingleton(void)
{
result r = E_SUCCESS;
- static _NetIpcProxy instance;
- r = instance.Construct();
+ unique_ptr<_NetIpcProxy> pInstance(new (std::nothrow) _NetIpcProxy());
+ SysTryReturnVoidResult(NID_NET, pInstance != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = pInstance->Construct();
SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- __pInstance = &instance;
+ ClearLastResult();
+
+ __pInstance = pInstance.release();
}
result
std::unique_ptr<Tizen::Io::_IpcClient> __pIpcClient;
static _NetIpcProxy* __pInstance;
+ friend class std::default_delete<_NetIpcProxy>;
+
}; // _NetIpcProxy
}}
*/
#include <pthread.h>
+#include <unique_ptr.h>
#include <FBaseResult.h>
#include <FBaseObject.h>
#include <FBaseString.h>
#include <FBaseSysLog.h>
#include "FNet_NetUtility.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Base::Runtime;
_NetUtility::InitLock(void)
{
result r = E_SUCCESS;
- static Mutex lock;
- r = lock.Create(L"NetLock");
+ unique_ptr<Mutex> pLock(new (std::nothrow) Mutex());
+ SysTryReturnVoidResult(NID_NET, pLock != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = pLock->Create(L"NetLock");
SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- __pLock = &lock;
+ ClearLastResult();
+ __pLock = pLock.release();
}
}} // Tizen::Net
*/
#include <pthread.h>
+#include <unique_ptr.h>
#include <net_connection.h>
#include <FNetNetConnectionInfo.h>
#include <FBaseRtMutexGuard.h>