1 | /* |
2 | Copyright (c) 2005-2019 Intel Corporation |
3 | |
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 |
7 | |
8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | |
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. |
15 | */ |
16 | |
17 | #ifndef __TBB_null_rw_mutex_H |
18 | #define __TBB_null_rw_mutex_H |
19 | |
20 | #include "tbb_stddef.h" |
21 | |
22 | namespace tbb { |
23 | |
24 | //! A rw mutex which does nothing |
25 | /** A null_rw_mutex is a rw mutex that does nothing and simulates successful operation. |
26 | @ingroup synchronization */ |
27 | class null_rw_mutex : internal::mutex_copy_deprecated_and_disabled { |
28 | public: |
29 | //! Represents acquisition of a mutex. |
30 | class scoped_lock : internal::no_copy { |
31 | public: |
32 | scoped_lock() {} |
33 | scoped_lock( null_rw_mutex& , bool = true ) {} |
34 | ~scoped_lock() {} |
35 | void acquire( null_rw_mutex& , bool = true ) {} |
36 | bool upgrade_to_writer() { return true; } |
37 | bool downgrade_to_reader() { return true; } |
38 | bool try_acquire( null_rw_mutex& , bool = true ) { return true; } |
39 | void release() {} |
40 | }; |
41 | |
42 | null_rw_mutex() {} |
43 | |
44 | // Mutex traits |
45 | static const bool is_rw_mutex = true; |
46 | static const bool is_recursive_mutex = true; |
47 | static const bool is_fair_mutex = true; |
48 | }; |
49 | |
50 | } |
51 | |
52 | #endif /* __TBB_null_rw_mutex_H */ |
53 | |