+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBase_String.h
+ * @brief This is the header file for handling atomic operations.
+ */
+
+#ifndef _FBASE_INTERNAL_STRING_H_
+#define _FBASE_INTERNAL_STRING_H_
+
+namespace Tizen { namespace Base
+{
+namespace _String
+{
+
+/**
+ * Atomically add the value to the variable that pRefCount points to.
+ *
+ * @since 2.1
+ */
+inline int AtomicAdd(volatile int* pRefCount, int value)
+{
+#if defined(__arm__)
+ register int result;
+ asm volatile (
+ "1: ldrex %0, [%1] \n\t"
+ "add r1, %0, %2 \n\t"
+ "strex r2, r1, [%1] \n\t"
+ "cmp r2, #0 \n\t"
+ "bne 1b"
+ : "=&r" (result)
+ : "r"(pRefCount), "r"(value)
+ : "r1","r2"
+ );
+ return result;
+#else
+ return __sync_fetch_and_add(pRefCount, value);
+#endif
+}
+
+/**
+ * Atomically increase the variable that pRefCount points to by 1
+ *
+ * @since 2.1
+ */
+inline int AtomicInc(volatile int* pRefCount)
+{
+ return AtomicAdd(pRefCount, 1);
+}
+
+/**
+ * Atomically decrease the variable that pRefCount points to by 1
+ *
+ * @since 2.1
+ */
+inline int AtomicDec(volatile int* pRefCount)
+{
+ return AtomicAdd(pRefCount, -1);
+}
+
+}// _String
+}} // Tizen::Base
+
+#endif // _FBASE_INTERNAL_STRING_H_
\ No newline at end of file