iceoryx_doc  1.0.1
locking_policy.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 #ifndef IOX_POSH_POPO_BUILDING_BLOCKS_LOCKING_POLICY_HPP
17 #define IOX_POSH_POPO_BUILDING_BLOCKS_LOCKING_POLICY_HPP
18 
19 #include "iceoryx_utils/internal/posix_wrapper/mutex.hpp"
20 
21 namespace iox
22 {
23 namespace popo
24 {
26 {
27  public:
28  // needs to be public since we want to use std::lock_guard
29  void lock() const noexcept;
30  void unlock() const noexcept;
31  bool tryLock() const noexcept;
32 
33  private:
34  mutable posix::mutex m_mutex{true}; // recursive lock
35 };
36 
38 {
39  public:
40  // needs to be public since we want to use std::lock_guard
41  void lock() const noexcept;
42  void unlock() const noexcept;
43  bool tryLock() const noexcept;
44 };
45 
46 } // namespace popo
47 } // namespace iox
48 
49 #endif // IOX_POSH_POPO_BUILDING_BLOCKS_LOCKING_POLICY_HPP
Definition: locking_policy.hpp:38
Definition: locking_policy.hpp:26
Definition: service_description.hpp:29