Goby3  3.1.5
2024.05.14
health_monitor_thread.h
Go to the documentation of this file.
1 // Copyright 2017-2023:
2 // GobySoft, LLC (2013-)
3 // Community contributors (see AUTHORS file)
4 // File authors:
5 // Toby Schneider <toby@gobysoft.org>
6 //
7 //
8 // This file is part of the Goby Underwater Autonomy Project Libraries
9 // ("The Goby Libraries").
10 //
11 // The Goby Libraries are free software: you can redistribute them and/or modify
12 // them under the terms of the GNU Lesser General Public License as published by
13 // the Free Software Foundation, either version 2.1 of the License, or
14 // (at your option) any later version.
15 //
16 // The Goby Libraries are distributed in the hope that they will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public License
22 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
23 
24 #ifndef GOBY_MIDDLEWARE_CORONER_HEALTH_MONITOR_THREAD_H
25 #define GOBY_MIDDLEWARE_CORONER_HEALTH_MONITOR_THREAD_H
26 
30 
32 
33 namespace goby
34 {
35 namespace middleware
36 {
37 struct NullConfig
38 {
39 };
40 
41 class HealthMonitorThread : public SimpleThread<NullConfig>
42 {
43  public:
45 
46  private:
47  void loop() override;
48  void initialize() override { this->set_name("health_monitor"); }
49 
50  private:
51  protobuf::ProcessHealth health_response_;
52  // uid to response
53  std::map<int, std::shared_ptr<const protobuf::ThreadHealth>> child_responses_;
54  goby::time::SteadyClock::time_point last_health_request_time_;
55  const goby::time::SteadyClock::duration health_request_timeout_{std::chrono::seconds(1)};
56  bool waiting_for_responses_{false};
57 };
58 
59 } // namespace middleware
60 } // namespace goby
61 
62 #endif
Implements Thread for a three layer middleware setup ([ intervehicle [ interprocess [ interthread ] ]...
Definition: simple_thread.h:46
void set_name(const std::string &name)
Definition: thread.h:151
The global namespace for the Goby project.
std::chrono::time_point< SteadyClock > time_point
Definition: steady_clock.h:45
std::chrono::microseconds duration
Duration type.
Definition: steady_clock.h:42