iceoryx_doc  1.0.1
condition_notifier.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
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 // SPDX-License-Identifier: Apache-2.0
17 #ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CONDITION_NOTIFIER_HPP
18 #define IOX_POSH_POPO_BUILDING_BLOCKS_CONDITION_NOTIFIER_HPP
19 
20 #include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
21 #include "iceoryx_utils/cxx/helplets.hpp"
22 
23 namespace iox
24 {
25 namespace popo
26 {
29 {
30  public:
31  static constexpr uint64_t INVALID_NOTIFICATION_INDEX = std::numeric_limits<uint64_t>::max();
32 
33  ConditionNotifier(ConditionVariableData& condVarDataRef, const uint64_t index) noexcept;
34 
35  ConditionNotifier(const ConditionNotifier& rhs) = delete;
36  ConditionNotifier(ConditionNotifier&& rhs) noexcept = delete;
37  ConditionNotifier& operator=(const ConditionNotifier& rhs) = delete;
38  ConditionNotifier& operator=(ConditionNotifier&& rhs) noexcept = delete;
39  ~ConditionNotifier() noexcept = default;
40 
42  void notify() noexcept;
43 
44  protected:
45  const ConditionVariableData* getMembers() const noexcept;
46  ConditionVariableData* getMembers() noexcept;
47 
48  private:
49  ConditionVariableData* m_condVarDataPtr{nullptr};
50  uint64_t m_notificationIndex = INVALID_NOTIFICATION_INDEX;
51 };
52 
53 } // namespace popo
54 } // namespace iox
55 
56 #endif // IOX_POSH_POPO_BUILDING_BLOCKS_CONDITION_VARIABLE_SIGNALER_HPP
ConditionNotifier can notifiy waiting threads and processes using a shared memory condition variable.
Definition: condition_notifier.hpp:29
void notify() noexcept
If threads are waiting on the condition variable, this call unblocks one of the waiting threads.
Definition: service_description.hpp:29
Definition: condition_variable_data.hpp:31