17 #ifndef IOX_POSH_ROUDI_ROUDI_MULTI_PROCESS_HPP
18 #define IOX_POSH_ROUDI_ROUDI_MULTI_PROCESS_HPP
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_posh/internal/capro/capro_message.hpp"
22 #include "iceoryx_posh/internal/roudi/introspection/mempool_introspection.hpp"
23 #include "iceoryx_posh/internal/roudi/process_manager.hpp"
24 #include "iceoryx_posh/internal/runtime/ipc_interface_creator.hpp"
25 #include "iceoryx_posh/mepoo/mepoo_config.hpp"
26 #include "iceoryx_posh/roudi/memory/roudi_memory_interface.hpp"
27 #include "iceoryx_posh/roudi/memory/roudi_memory_manager.hpp"
28 #include "iceoryx_posh/roudi/roudi_app.hpp"
29 #include "iceoryx_utils/cxx/generic_raii.hpp"
30 #include "iceoryx_utils/internal/concurrent/smart_lock.hpp"
31 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
32 #include "iceoryx_utils/platform/file.hpp"
33 #include "iceoryx_utils/posix_wrapper/posix_access_rights.hpp"
43 using namespace iox::units::duration_literals;
60 const bool killProcessesInDestructor =
true,
62 const version::CompatibilityCheckLevel compatibilityCheckLevel = version::CompatibilityCheckLevel::PATCH,
63 const units::Duration processKillDelay = roudi::PROCESS_DEFAULT_KILL_DELAY) noexcept
64 : m_monitoringMode(monitoringMode)
65 , m_killProcessesInDestructor(killProcessesInDestructor)
67 , m_compatibilityCheckLevel(compatibilityCheckLevel)
68 , m_processKillDelay(processKillDelay)
73 const bool m_killProcessesInDestructor;
75 const version::CompatibilityCheckLevel m_compatibilityCheckLevel;
76 const units::Duration m_processKillDelay;
99 const iox::runtime::IpcMessageType& cmd,
100 const RuntimeName_t& runtimeName);
101 virtual void cyclicUpdateHook();
102 void IpcMessageErrorHandler();
107 int64_t& transmissionTimestamp);
118 const posix::PosixUser user,
119 const int64_t transmissionTimestamp,
120 const uint64_t sessionId,
121 const version::VersionInfo& versionInfo);
128 void processRuntimeMessages();
130 void monitorAndDiscoveryUpdate();
132 cxx::GenericRAII m_unregisterRelativePtr{[] {}, [] { rp::BaseRelativePointer::unregisterAll(); }};
133 bool m_killProcessesInDestructor;
134 std::atomic_bool m_runMonitoringAndDiscoveryThread;
135 std::atomic_bool m_runHandleRuntimeMessageThread;
137 const units::Duration m_runtimeMessagesThreadTimeout{100_ms};
139 RouDiMemoryInterface* m_roudiMemoryInterface{
nullptr};
143 cxx::GenericRAII m_roudiMemoryManagerCleaner{[]() {},
145 if (this->m_roudiMemoryInterface->destroyMemory().has_error())
147 LogWarn() <<
"unable to cleanup roudi memory interface";
151 concurrent::smart_lock<ProcessManager> m_prcMgr;
154 std::thread m_monitoringAndDiscoveryThread;
155 std::thread m_handleRuntimeMessageThread;
163 units::Duration m_processKillDelay;
Definition: port_manager.hpp:55
Definition: roudi_memory_interface.hpp:36
RuntimeMessagesThreadStart
Indicate whether the thread processing messages from the runtimes will start directly or deferred thi...
Definition: roudi.hpp:51
static uint64_t getUniqueSessionIdForProcess()
Creates a unique ID which can be used to check outdated IPC channel transmissions.
void shutdown()
Stops threads and kills all process known to RouDi Called in d'tor.
void startProcessRuntimeMessagesThread()
Starts the thread processing messages from the runtimes Once this is done, applications can register ...
void registerProcess(const RuntimeName_t &name, const uint32_t pid, const posix::PosixUser user, const int64_t transmissionTimestamp, const uint64_t sessionId, const version::VersionInfo &versionInfo)
Handles the registration request from process.
Definition: ipc_message.hpp:43
MonitoringMode
Controls process alive monitoring. Upon timeout, a monitored process is removed and its resources are...
Definition: iceoryx_posh_types.hpp:221
ProcessIntrospection< PublisherPortUserType > ProcessIntrospectionType
typedef for the templated process introspection class that is used by RouDi for the actual process in...
Definition: process_introspection.hpp:110
MemPoolIntrospection< mepoo::MemoryManager, mepoo::SegmentManager<>, PublisherPortUserType > MemPoolIntrospectionType
typedef for the templated mempool introspection class that is used by RouDi for the actual mempool in...
Definition: mempool_introspection.hpp:97
Definition: service_description.hpp:29