Merge "Change error condition of ToDouble()&ToFloat()" into tizen_2.2
authordahyeong.kim <dahyeong.kim@samsung.com>
Thu, 13 Jun 2013 10:50:15 +0000 (10:50 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 13 Jun 2013 10:50:15 +0000 (10:50 +0000)
29 files changed:
inc/FAppAppControlProviderManager.h
inc/FAppIAppControlProviderEventListener.h
inc/FAppIAppControlResponseListener.h
inc/FAppNotificationManager.h
inc/FBaseColIteratorT.h
inc/FBaseColPairIteratorT.h
inc/FBaseColRandomIteratorT.h
inc/FBaseColStlConverter.h
inc/FBaseDoubleComparer.h
inc/FBaseFloatComparer.h
inc/FBaseInt8Comparer.h
inc/FBaseLongComparer.h
inc/FBaseLongLongComparer.h
inc/FBaseObject.h
inc/FBaseRtMonitor.h
inc/FBaseShortComparer.h
inc/FBaseStringComparer.h
inc/FBaseStringHashCodeProvider.h
inc/FBaseUtilStringTokenizer.h
inc/FBaseUtilStringUtil.h
inc/FIoClientChannel.h
inc/FIoIChannelResponseEventListener.h
inc/FIoServerChannel.h
inc/FSysIRuntimeInfoGetIntAsyncResultListener.h
inc/FSysIRuntimeInfoGetLonglongAsyncResultListener.h
inc/FXml.h
src/server/security/FSec_PrivilegeManagerServer.cpp
src/system/FSys_AlarmManager.cpp
src/system/inc/FSys_AlarmManager.h

index 8083d6c..fe2038d 100644 (file)
@@ -42,7 +42,7 @@ class IAppControlProviderEventListener;
 
 /**
  * @class      AppControlProviderManager
- * @brief      This class manages the AppControl provider.
+ * @brief      This class manages the %AppControl provider.
  *
  * @since      2.0
  *
index 87018b0..2137be4 100644 (file)
@@ -38,7 +38,7 @@ namespace Tizen { namespace App
 
 /**
 *   @interface  IAppControlProviderEventListener
-*   @brief      This interface defines the provider listener for the AppControl request.
+*   @brief      This interface defines the provider listener for the %AppControl request.
 *
 *   @since     2.0
 *
index 73e5762..2bcf2c8 100644 (file)
@@ -38,7 +38,7 @@ namespace Tizen { namespace App
 
 /**
 * @interface   IAppControlResponseListener
-* @brief               This interface defines a listener for the AppControl response events.
+* @brief               This interface defines a listener for the %AppControl response events.
 *
 * @since       2.0
 *
index ccc9870..954f572 100644 (file)
 //
 
 /**
+ * @if OSPDEPREC
  * @file               FAppNotificationManager.h
  * @brief              This is the header file for the %NotificationManager class.
  *
  * This header file contains the declarations of the %NotificationManager class.
+ * @endif
  */
 
 #ifndef _FAPP_NOTIFICATION_MANAGER_H_
index f9598fa..7e38af6 100644 (file)
@@ -35,8 +35,8 @@ namespace Tizen { namespace Base { namespace Collection
 {
 /**
  * @class      IteratorT
- * @brief      This class provides an iterator that is used to convert IList to STL containers. @n
- *                     StlConverter provides static methods to get this iterator from %IList.
+ * @brief      This class provides an iterator that is used to convert %IList to STL containers. @n
+ *                     %StlConverter provides static methods to get this iterator from %IList.
  *
  * @since      2.1
  *
index e2d89e4..3d71646 100644 (file)
@@ -37,8 +37,8 @@ namespace Tizen { namespace Base { namespace Collection
 {
 /**
  * @class      PairIteratorT
- * @brief      This class provides an iterator that is used to convert IMap or IMultiMap to STL containers. @n
- *                     StlConverter provides static methods to get this iterator from %IMap or %IMultiMap.
+ * @brief      This class provides an iterator that is used to convert %IMap or %IMultiMap to STL containers. @n
+ *                     %StlConverter provides static methods to get this iterator from %IMap or %IMultiMap.
  *
  * @since      2.1
  *
index b792bf2..677bd83 100644 (file)
@@ -34,8 +34,8 @@ namespace Tizen { namespace Base { namespace Collection
 {
 /**
  * @class      RandomIteratorT
- * @brief      This class provides a random iterator that is used to convert IList to STL containers. @n
- *                     StlConverter provides static methods to get this random iterator from %IList.
+ * @brief      This class provides a random iterator that is used to convert %IList to STL containers. @n
+ *                     %StlConverter provides static methods to get this random iterator from %IList.
  *
  * @since      2.1
  *
index 6f92448..e6c282d 100644 (file)
@@ -43,7 +43,7 @@ class IMultiMap;
 
 /**
  *     @class  StlConverter
- *     @brief  This class provides static methods to convert %Tizen Collection to STL Container and vice versa.
+ *     @brief  This class provides static methods to convert %Tizen %Collection to STL Container and vice versa.
  *
  *     @since  2.1
  *
index fd13812..c7f826b 100644 (file)
@@ -33,7 +33,7 @@ namespace Tizen { namespace Base
 {
 /**
  *     @class  DoubleComparer
- *     @brief  This class checks for equivalence between 2 instances of the Double type.
+ *     @brief  This class checks for equivalence between 2 instances of the %Double type.
  *
  *     @since 2.0
  *
index 90d186a..4056ed0 100644 (file)
@@ -33,7 +33,7 @@ namespace Tizen { namespace Base
 {
 /**
  *     @class  FloatComparer
- *     @brief  This class checks for equivalence between 2 instances of the Float type.
+ *     @brief  This class checks for equivalence between 2 instances of the %Float type.
  *
  *     @since 2.0
  *
index e744f4a..3983fe1 100644 (file)
@@ -34,7 +34,7 @@ namespace Tizen { namespace Base
 {
 /**
  *     @class  Int8Comparer
- *     @brief  This class checks for equivalence between 2 instances of the Int8 type.
+ *     @brief  This class checks for equivalence between 2 instances of the %Int8 type.
  *
  *     @since 2.0
  *
index 2073009..1c1aa7d 100644 (file)
@@ -34,7 +34,7 @@ namespace Tizen { namespace Base
 {
 /**
  * @class      LongComparer
- * @brief      This class checks for equivalence between 2 instances of the Long type.
+ * @brief      This class checks for equivalence between 2 instances of the %Long type.
  *
  * @since 2.0
  *
index cb55eb0..654f283 100644 (file)
@@ -34,7 +34,7 @@ namespace Tizen { namespace Base
 {
 /**
  * @class      LongLongComparer
- * @brief      This class checks for equivalence between 2 instances of the LongLong type.
+ * @brief      This class checks for equivalence between 2 instances of the %LongLong type.
  *
  * @since 2.0
  *
index cae5688..2ab0af2 100644 (file)
@@ -33,7 +33,7 @@ namespace Tizen { namespace Base
 {
 /**
  * @class      Object
- * @brief      This class is the @b root class of Tizen.
+ * @brief      This class is the root class of %Tizen.
  *
  * @since 2.0
  *
index 35e2ab3..b9696ac 100755 (executable)
@@ -35,7 +35,7 @@ class _MonitorImpl;
 
 /**
  * @class   Monitor
- * @brief      This represents a monitor; a type of synchronization mechanism that provides acquire/release semantics by Enter() / Exit() as well as wait/notify semantics by Wait() / Notify() / NotifyAll().
+ * @brief      This class represents a monitor that is a type of synchronization mechanism.
  *
  * @since 2.0
  *
index cd010a8..36ad325 100644 (file)
@@ -35,7 +35,7 @@ namespace Tizen { namespace Base
 {
 /**
  *     @class  ShortComparer
- *     @brief  This class compares 2 instances of the Short type for equivalence.
+ *     @brief  This class compares 2 instances of the %Short type for equivalence.
  *
  *     @since 2.0
  *
index c0729c1..98bb08f 100644 (file)
@@ -35,7 +35,7 @@ namespace Tizen { namespace Base
 {
 /**
  * @class      StringComparer
- * @brief      This class checks for equivalence between 2 instances of the String type.
+ * @brief      This class checks for equivalence between 2 instances of the %String type.
  *
  * @since 2.0
  *
index 3372640..9e98d1e 100644 (file)
@@ -31,7 +31,7 @@ namespace Tizen { namespace Base
 {
 /**
  * @class      StringHashCodeProvider
- * @brief      This class provides the hash code of an instance of type String.
+ * @brief      This class provides the hash code of an instance of type %String.
  *
  * @since      2.1
  *
index 41700f6..d880cc6 100644 (file)
@@ -34,7 +34,7 @@ namespace Tizen { namespace Base { namespace Utility
 {
 /**
  * @class      StringTokenizer
- * @brief      This class is used to break a String into tokens.
+ * @brief      This class is used to break a %String into tokens.
  *
  * @since 2.0
  *
index 6f87af8..f6ff573 100644 (file)
@@ -33,7 +33,7 @@ namespace Tizen { namespace Base { namespace Utility
 {
 /**
  * @class      StringUtil
- * @brief      This class provides various utility methods for String.
+ * @brief      This class provides various utility methods for %String.
  *
  * @since 2.0
  *
index 550f3c0..4c75e4f 100644 (file)
 // limitations under the License.
 //
 /**
+ * @if OSPDEPREC
  * @file               FIoClientChannel.h
  * @brief              This is the header file for the %ClientChannel class.
  *
  * This header file contains the declarations of the %ClientChannel class.
+ * @endif
  */
 #ifndef _FIO_CLIENT_CHANNEL_H_
 #define _FIO_CLIENT_CHANNEL_H_
index 86520d4..998e533 100644 (file)
 // limitations under the License.
 //
 /**
+ * @if OSPDEPREC
  * @file               FIoIChannelResponseEventListener.h
  * @brief              This is the header file for the %IChannelResponseEventListener interface.
  *
  * This header file contains the declarations of the %IChannelResponseEventListener interface.
- *
+ * @endif
  */
 #ifndef _FIO_ICHANNEL_RESPONSEEVENT_LISTENER_H_
 #define _FIO_ICHANNEL_RESPONSEEVENT_LISTENER_H_
index 5a3c9bc..0111068 100644 (file)
 // limitations under the License.
 //
 /**
+ * @if OSPDEPREC
  * @file               FIoServerChannel.h
  * @brief              This is the header file for the %ServerChannel class.
  *
  * This header file contains the declarations of the %ServerChannel class.
+ * @endif
  */
 #ifndef _FIO_SERVER_CHANNEL_H_
 #define _FIO_SERVER_CHANNEL_H_
index 50182fb..3a17c89 100644 (file)
@@ -32,7 +32,7 @@ namespace Tizen { namespace System
  
 /**
 * @interface     IRuntimeInfoGetIntAsyncResultListener
-* @brief          This interface defines the result listener for an asynchronous method call to the RuntimeInfo class.
+* @brief          This interface defines the result listener for an asynchronous method call to the %RuntimeInfo class.
 *
 * @since 2.0
 *
index 1915a9e..2e8c177 100644 (file)
@@ -32,7 +32,7 @@ namespace Tizen { namespace System
  
 /**
 * @interface     IRuntimeInfoGetLonglongAsyncResultListener
-* @brief          This interface defines the result listener for an asynchronous method call to the RuntimeInfo class.
+* @brief          This interface defines the result listener for an asynchronous method call to the %RuntimeInfo class.
 *
 * @since 2.0
 *
index b95dc13..7fd363b 100755 (executable)
 //
 
 /**
+ * @if OSPDEPREC
  * @file                       FXml.h
  * @brief                      This is the header file for the Tizen::Xml namespace.
  *
  * This header file contains the introduction of the Tizen::Xml namespace.
+ * @endif
  */
 #ifndef _FXML_H_
 #define _FXML_H_
index 4fcfd45..b6fcecc 100644 (file)
@@ -196,17 +196,14 @@ _PrivilegeManagerServer::GetChecksum(AppId appId, int visibility, String& checks
        ByteBuffer input;
        IHmac* pHmac = null;
        ByteBuffer* pChecksumByteBuffer = null;
-       char* pAppId = null;
 
-       pAppId = (char*) _StringConverter::CopyToCharArrayN(appId);
+       std::unique_ptr<char[]> pAppId(null);
+       pAppId.reset(_StringConverter::CopyToCharArrayN(appId));
        SysTryCatch(NID_SEC, pAppId != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
-       memcpy(tempChecksumString, pAppId, MAX_APP_ID_SIZE);
+       memcpy(tempChecksumString, pAppId.get(), MAX_APP_ID_SIZE);
        memcpy(tempChecksumString + MAX_APP_ID_SIZE, (byte*)(&visibility), sizeof(int));
 
-       delete[] pAppId;
-       pAppId = null;
-
        r = input.Construct(MAX_APP_ID_SIZE + sizeof(int));
        SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
index 6f622f4..06f8457 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <unique_ptr.h>
+
 #include <appfw/app.h>
 #include <alarm.h>
 #include <appsvc/appsvc.h>
@@ -42,12 +43,15 @@ namespace Tizen { namespace System
 {
 static const long _SECOND_OF_MINUTE = 60;
 
-_AlarmManager* _AlarmManager::pAlarmManager = null;
+_AlarmManager* _AlarmManager::__pAlarmManager = null;
 
 _AlarmManager::_AlarmManager()
        : __pAlarmHashMap(null)
 {
        result r = E_SUCCESS;
+       int ret = pthread_mutex_init(&__lock, null);
+       SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, E_SYSTEM, "It is failed to init mutex.");
+
        __alarmList.Construct();
 
        if (!__pAlarmHashMap)
@@ -68,6 +72,12 @@ CATCH:
 
 _AlarmManager::~_AlarmManager()
 {
+       int ret = pthread_mutex_destroy(&__lock);
+       if(ret != 0)
+       {
+               SysLogException(NID_SYS, E_SYSTEM, "It is failed to destroy mutex.");
+       }
+
        delete __pAlarmHashMap;
        __pAlarmHashMap = null;
 
@@ -78,11 +88,29 @@ _AlarmManager::~_AlarmManager()
 _AlarmManager*
 _AlarmManager::GetInstance(void)
 {
-       if(pAlarmManager == null)
+       static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+       if(__pAlarmManager == null)
        {
-               pAlarmManager = new (std::nothrow) _AlarmManager();
+               pthread_once(&onceBlock, InitSingleton);
        }
-       return pAlarmManager;
+       return __pAlarmManager;
+}
+
+void
+_AlarmManager::InitSingleton(void)
+{
+       _AlarmManager* pAlarmManager = new (std::nothrow) _AlarmManager();
+       SysTryReturnVoidResult(NID_SYS, pAlarmManager, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+                                                  GetErrorMessage(E_OUT_OF_MEMORY));
+
+       __pAlarmManager = pAlarmManager;
+       std::atexit(DestroySingleton);
+}
+
+void
+_AlarmManager::DestroySingleton(void)
+{
+       delete __pAlarmManager;
 }
 
 int
@@ -343,7 +371,10 @@ _AlarmManager::RegisterAlarm(_AlarmImpl* pAlarmImpl)
        String endTimeStr;
        String appId;
 
+       int reservedAlarmId = 0;
        int period = pAlarmImpl->GetPeriod();
+       int ret = 0;
+       Tizen::App::App* pApp = null;
  
        DateTime currentTime;
        DateTime startTime = pAlarmImpl->GetStartTime();
@@ -359,26 +390,24 @@ _AlarmManager::RegisterAlarm(_AlarmImpl* pAlarmImpl)
        SysTryReturnResult(NID_SYS, DateTime::Compare(currentTime, startTime) < 0, E_INVALID_ARG, "Designated start time has to be greater than current time.");
        SysTryReturnResult(NID_SYS, period > -1, E_INVALID_ARG, "Period has to greater than -1");
 
+       ret = pthread_mutex_lock(&__lock);
+       SysTryCatch(NID_SYS, ret == 0, r = E_INVALID_ARG, r, "It is failed to lock mutex.");
+
        if(pEndTime != null)
        {
                endTime = *pEndTime;
                endTime.AddMilliseconds(-1 * endTime.GetMillisecond());
 
-               SysTryReturnResult(NID_SYS, DateTime::Compare(startTime, endTime) < 0, E_INVALID_ARG, "Designated end time is less than start time.");
+               SysTryCatch(NID_SYS, DateTime::Compare(startTime, endTime) < 0, r = E_INVALID_ARG, r, "Designated end time is less than start time.");
        }
        //End Alarm validation check
 
-       Tizen::App::App* pApp = Tizen::App::App::GetInstance();
-       SysTryReturnResult(NID_SYS, pApp != null, E_SYSTEM, "[%s] A system error has been occurred. App::GetInstance() failed.", GetErrorMessage(E_SYSTEM));
+       pApp = Tizen::App::App::GetInstance();
+       SysTryCatch(NID_SYS, pApp != null, r = E_SYSTEM, r, "[%s] A system error has been occurred. App::GetInstance() failed.", GetErrorMessage(E_SYSTEM));
        appId = pApp->GetAppId();
 
-       String* result = null;
-       int reservedAlarmId = 0;
-
-       SysLog(NID_SYS, "Alarm setting request");
-
        reservedAlarmId = ReserveAlarm(appId, startTime, period);
-       SysTryReturnResult(NID_SYS, reservedAlarmId != -1, E_SYSTEM, "It is failed to register alarm.");
+       SysTryCatch(NID_SYS, reservedAlarmId != -1, r = E_SYSTEM, r, "It is failed to register alarm.");
 
        SysLog(NID_SYS, "Reserved AppId %ls, alarmId: %d", appId.GetPointer(), reservedAlarmId);
 
@@ -390,31 +419,41 @@ _AlarmManager::RegisterAlarm(_AlarmImpl* pAlarmImpl)
        {
                r = AddAlarmList(reservedAlarmId, period, appId, (DateTime*)(&endTime));
        }
-       SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add new alarm on the alarm list.");
+       SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to add new alarm on the alarm list.");
 
        pAlarmImpl->__alarmId.value = reservedAlarmId;
        r = __alarmList.Add(&(pAlarmImpl->__alarmId), pAlarmImpl);
 
+CATCH:
+       ret = pthread_mutex_unlock(&__lock);
+       SysTryReturnResult(NID_SYS, ret == 0, E_INVALID_ARG, "It is failed to unlock mutex.");
        return r;
 }
 
 result
 _AlarmManager::UnregisterAlarm(_AlarmImpl* pAlarmImpl)
 {
+       result r = E_SUCCESS;
+       Integer alarmId;
+       int ret = 0;
        SysLog(NID_SYS, "Alarm Cancel request");
+       SysTryCatch(NID_SYS, pAlarmImpl != null, r = E_INVALID_ARG, r, "There is no alarmImpl.");
 
-       result r = E_SUCCESS;
-       SysTryReturnResult(NID_SYS, pAlarmImpl != null, E_INVALID_ARG, "There is no alarmImpl.");
+       ret = pthread_mutex_lock(&__lock);
+       SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to lock mutex.");
 
-       Integer alarmId(pAlarmImpl->__alarmId.value);
-       SysTryReturnResult(NID_SYS, __alarmList.ContainsKey(alarmId) == true, E_OBJ_NOT_FOUND, "There is no registered alarm.");
+       alarmId.value = pAlarmImpl->__alarmId.value;
+       SysTryCatch(NID_SYS, __alarmList.ContainsKey(alarmId) == true, r = E_OBJ_NOT_FOUND, r, "There is no registered alarm.");
 
        r = __alarmList.Remove(alarmId);
-       SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to remove reserved alarmImpl instance.");
+       SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to remove reserved alarmImpl instance.");
 
        r = RemoveAlarmList(alarmId.ToInt());
-       SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to remove reserved alarm list.");
+       SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to remove reserved alarm list.");
 
+CATCH:
+       ret = pthread_mutex_unlock(&__lock);
+       SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "It is failed to unlock mutex.");
        return r;
 }
 
@@ -422,15 +461,23 @@ result
 _AlarmManager::UpdateAlarm(_AlarmImpl* pAlarmImpl)
 {
        result r = E_SUCCESS;
-       SysTryReturnResult(NID_SYS, pAlarmImpl != null, E_INVALID_ARG, "There is no alarmImpl.");
+       int ret = 0;
+       Integer alarmId;
+       SysTryCatch(NID_SYS, pAlarmImpl != null, r = E_INVALID_ARG, r, "There is no alarmImpl.");
 
-       Integer alarmId(pAlarmImpl->__alarmId.value);
-       SysTryReturnResult(NID_SYS, __alarmList.ContainsKey(alarmId) == true, E_OBJ_NOT_FOUND, "There is no registered alarm.");
+       ret = pthread_mutex_lock(&__lock);
+       SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to lock mutex.");
+
+       alarmId.value = pAlarmImpl->__alarmId.value;
+       SysTryCatch(NID_SYS, __alarmList.ContainsKey(alarmId) == true, r = E_OBJ_NOT_FOUND, r, "There is no registered alarm.");
 
        r = UnregisterAlarm(pAlarmImpl);
-       SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to unregister reserved alarm list.");
+       SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to unregister reserved alarm list.");
 
        r = RegisterAlarm(pAlarmImpl);
+CATCH:
+       ret = pthread_mutex_unlock(&__lock);
+       SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "It is failed to unlock mutex.");
        return r;
 }
 
@@ -438,18 +485,21 @@ void
 _AlarmManager::OnAlarmExpired(int alarmId)
 {
        result r = E_SUCCESS;
+       int ret = 0;
        String* pAppId = null;
        Integer* pPeriod = null;
+       String alarmAppId;
        std::unique_ptr<IEnumerator> pValueEnum(null);
        Integer reservedAlarmId(alarmId);
        DateTime* endTime = null;
+       _AlarmImpl* pAlarmImpl = null;
 
-       SysTryReturnVoidResult(NID_SYS, __pAlarmHashMap != null, E_SYSTEM, "Alarm list does not initialized");
+       SysTryCatch(NID_SYS, __pAlarmHashMap != null, r = E_SYSTEM, r, "Alarm list does not initialized");
        pValueEnum.reset(__pAlarmHashMap->GetValuesN(reservedAlarmId));
 
        SysLog(NID_SYS, "Alarm expire event is delivered. alarm id is %d", alarmId);
 
-       _AlarmImpl* pAlarmImpl = (_AlarmImpl*)__alarmList.GetValue(reservedAlarmId);
+       pAlarmImpl = (_AlarmImpl*)__alarmList.GetValue(reservedAlarmId);
        if(pAlarmImpl == null)
        {
                SysLog(NID_SYS, "pAlarmImpl of reserved alarm[%d] is not found.", alarmId);
@@ -457,15 +507,17 @@ _AlarmManager::OnAlarmExpired(int alarmId)
 
        if(pValueEnum != null)
        {
-               String alarmAppId;
+               ret = pthread_mutex_lock(&__lock);
+               SysTryCatch(NID_SYS, ret == 0, r = E_SYSTEM, r, "It is failed to lock mutex.");
+
                SysLog(NID_SYS, "Matching Alarm Id is %d \n", alarmId);
                r = pValueEnum->MoveNext();
-               SysTryReturnVoidResult(NID_SYS,  r == E_SUCCESS, E_SYSTEM, "Alarm enum value is not valid.");
+               SysTryCatch(NID_SYS,  r == E_SUCCESS, r = E_SYSTEM, r, "Alarm enum value is not valid.");
                pAppId = static_cast< String* >(pValueEnum->GetCurrent());
                alarmAppId.Append(*pAppId);
                r = pValueEnum->MoveNext();
                pPeriod = static_cast< Integer* >(pValueEnum->GetCurrent());
-               SysTryReturnVoidResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Alarm enum value is not valid.");
+               SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "Alarm enum value is not valid.");
 
                if(pValueEnum->MoveNext() == E_SUCCESS)
                {
@@ -512,6 +564,8 @@ _AlarmManager::OnAlarmExpired(int alarmId)
                {
                        pValueEnum->Reset();
                }
+
+               ret = pthread_mutex_unlock(&__lock);
        }
 
        if(pAlarmImpl != null)
@@ -521,12 +575,16 @@ _AlarmManager::OnAlarmExpired(int alarmId)
 
        if(__pAlarmHashMap->ContainsKey(reservedAlarmId) == false)
        {
+               ret = pthread_mutex_lock(&__lock);
                SysLog(NID_SYS, "Remove an alarm list[%d].", reservedAlarmId.value);
                r = __alarmList.Remove(reservedAlarmId);
+               ret = pthread_mutex_unlock(&__lock);
                SetLastResult(r);
        }
 
-       return;
+CATCH:
+       ret = pthread_mutex_unlock(&__lock);
+       SysTryReturnVoidResult(NID_SYS, ret == 0, E_SYSTEM, "It is failed to unlock mutex.");
 }
 
 } } // Tizen::System
index 19bffc8..9fea083 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _FSYSTEM_INTERNAL_ALARM_MANAGER_H_
 #define _FSYSTEM_INTERNAL_ALARM_MANAGER_H_
 
+#include <pthread.h>
 #include <FBaseColMultiHashMap.h>
 #include <FSys_AlarmImpl.h>
 
@@ -49,11 +50,15 @@ private:
        result RemoveAlarmList(int alarmId);
        result RemoveAlarmList(Tizen::Base::String appId);
 
+       static void InitSingleton(void);
+       static void DestroySingleton(void);
+
 private:
+       pthread_mutex_t                         __lock;
        Tizen::Base::Collection::HashMap        __alarmList;
        Tizen::Base::Collection::MultiHashMap*  __pAlarmHashMap;
 
-       static _AlarmManager* pAlarmManager;
+       static _AlarmManager* __pAlarmManager;
 };