5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-common.h>
25 * The top level DALi namespace
30 * Class to synchronize access to critical resources from multiple threads
32 class DALI_CORE_API Mutex
36 * @brief Constructor, acquires the mutex from the underlying OS
41 * @brief Destructor, non virtual as this is not meant as a base class
46 * @brief Move constructor
48 Mutex(Mutex&& rhs) noexcept;
51 * @brief Move assignment
53 Mutex& operator=(Mutex&& rhs) noexcept;
56 * @brief Check if the mutex is locked
57 * @return true if the mutex is locked
63 * Helper class to do a scoped lock on a mutex implementing the RAII idiom.
64 * Note! this class *does not* prevent a deadlock in the case when same thread is
65 * locking the same mutex twice.
67 class DALI_CORE_API ScopedLock
72 * @param mutex to lock
74 ScopedLock(Mutex& mutex);
77 * Destructor, releases the lock
86 /// Not implemented as Mutex is not copyable
88 const Mutex& operator=(const Mutex&);
96 #endif // DALI_MUTEX_H