/* Copyright (c) 2021 Intel Corporation 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. */ #ifndef __TBB_detail__mutex_common_H #define __TBB_detail__mutex_common_H #include "_config.h" #include "_utils.h" #if __TBB_CPP20_CONCEPTS_PRESENT #include namespace tbb { namespace detail { inline namespace d0 { template concept mutex_scoped_lock = std::default_initializable && std::constructible_from && requires( Lock& lock, Mutex& mutex ) { lock.acquire(mutex); { lock.try_acquire(mutex) } -> adaptive_same_as; lock.release(); }; template concept rw_mutex_scoped_lock = mutex_scoped_lock && std::constructible_from && requires( Lock& lock, Mutex& mutex ) { lock.acquire(mutex, false); { lock.try_acquire(mutex, false) } -> adaptive_same_as; { lock.upgrade_to_writer() } -> adaptive_same_as; { lock.downgrade_to_reader() } -> adaptive_same_as; }; template concept scoped_lockable = mutex_scoped_lock; template concept rw_scoped_lockable = scoped_lockable && rw_mutex_scoped_lock; } // namespace d0 } // namespace detail } // namespace tbb #endif // __TBB_CPP20_CONCEPTS_PRESENT #endif // __TBB_detail__mutex_common_H