2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseRtMutex.h
19 * @brief This is the header file for the %Mutex class.
21 * This header file contains the declarations of the %Mutex class.
24 #ifndef _TIZEN_MAPS_MUTEX_H_
25 #define _TIZEN_MAPS_MUTEX_H_
28 #include "HereMaps_global.h"
29 #include "base/BaseObject.h"
32 TIZEN_MAPS_BEGIN_NAMESPACE
36 : public Tizen::Maps::Object
40 * This is the default constructor for this class.
43 * @remarks After creating an instance of this class, you must explicitly call one of
44 * the Create() methods to initialize the instance.
49 * This is the destructor for this class.
56 * Creates an unnamed Mutex.
59 * @return An error code
60 * @exception E_SUCCESS The method was successful.
61 * @exception E_SYSTEM An unknown operating system error occurred.
66 * Creates a non-recursive mutex.
69 * @return An error code
70 * @exception E_SUCCESS The method was successful.
71 * @exception E_SYSTEM An unknown operating system error occurred.
73 result CreateNonRecursiveMutex(void);
76 * Creates a named Mutex. @n
77 * If there is already a Mutex with the specified name, this creates a Mutex which references that particular Mutex.
80 * @return An error code
81 * @param[in] name The name of the Mutex
82 * @exception E_SUCCESS The method was successful.
83 * @exception E_SYSTEM An unknown operating system error occurred.
85 result Create(const String& name);
88 * Acquires the Mutex if it is not acquired. @n
89 * If the Mutex is already acquired by another thread,
90 * the current thread is blocked until the Mutex is released.
93 * @return An error code
94 * @param[in] timeout The period during which the thread tries to acquire the mutex
95 * @exception E_SUCCESS The method was successful.
96 * @exception E_TIMEOUT The operation could not be completed within the specified time period. @n
97 * @exception E_SYSTEM An unknown operating system error occurred. @n
98 * Failed to acquire the Mutex because an OS failure occurred.
100 result Acquire(long timeout);
103 * Releases the Mutex.
106 * @return An error code
107 * @exception E_SUCCESS The method was successful.
108 * @exception E_SYSTEM An unknown operating system error occurred. @n
109 * Failed to acquire the Mutex because an OS failure occurred.
111 result Release(void);
114 * Acquires the Mutex if it is not acquired. @n
115 * If the Mutex is already acquired by another thread,
116 * the current thread is blocked until the Mutex is released.
119 * @return An error code
120 * @exception E_SUCCESS The method was successful.
121 * @exception E_SYSTEM An unknown operating system error occurred. @n
122 * Failed to acquire the Mutex because an OS failure occurred.
124 result Acquire(void);
127 * Acquires the mutex if it is not acquired. @n
128 * If the mutex is already acquired by another thread, E_OBJECT_LOCKED is returned.
132 * @return An error code
133 * @exception E_SUCCESS The method is successful.
134 * @exception E_OBJECT_LOCKED The mutex is already locked.
135 * @exception E_INVALID_STATE The mutex has not been initialized as yet.
136 * @exception E_SYSTEM A system error has occurred.
138 result TryToAcquire(void);
141 pthread_mutex_t* __pMutex;
148 TIZEN_MAPS_END_NAMESPACE
150 #endif // _TIZEN_MAPS_MUTEX_H_