]> granicus.if.org Git - icinga2/blob - lib/compat/externalcommandlistener.hpp
Merge pull request #7145 from Icinga/feature/dotnet-4.6
[icinga2] / lib / compat / externalcommandlistener.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef EXTERNALCOMMANDLISTENER_H
4 #define EXTERNALCOMMANDLISTENER_H
5
6 #include "compat/externalcommandlistener-ti.hpp"
7 #include "base/objectlock.hpp"
8 #include "base/timer.hpp"
9 #include "base/utility.hpp"
10 #include <thread>
11 #include <iostream>
12
13 namespace icinga
14 {
15
16 /**
17  * @ingroup compat
18  */
19 class ExternalCommandListener final : public ObjectImpl<ExternalCommandListener>
20 {
21 public:
22         DECLARE_OBJECT(ExternalCommandListener);
23         DECLARE_OBJECTNAME(ExternalCommandListener);
24
25         static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
26
27 protected:
28         void Start(bool runtimeCreated) override;
29         void Stop(bool runtimeRemoved) override;
30
31 private:
32 #ifndef _WIN32
33         std::thread m_CommandThread;
34
35         void CommandPipeThread(const String& commandPath);
36 #endif /* _WIN32 */
37 };
38
39 }
40
41 #endif /* EXTERNALCOMMANDLISTENER_H */