From 574dad5064a888d2861af03211c4e613febdb07e Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Wed, 1 May 2024 00:13:56 -0400 Subject: [PATCH 1/3] Fix issue #295 The JEventSourceGenerator needs to pass a JApplication pointer to the JEventSource constructor. However this pointer needs to be injected into the generator first. I'm hoping to get the JApplication pointer out of the EventSource constructor completely, and move all initialization logic into Init() instead. --- src/libraries/JANA/JApplication.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/JANA/JApplication.cc b/src/libraries/JANA/JApplication.cc index dc7e337f8..e3beba4bc 100644 --- a/src/libraries/JANA/JApplication.cc +++ b/src/libraries/JANA/JApplication.cc @@ -124,12 +124,12 @@ void JApplication::Initialize() { // Attach all plugins plugin_loader->attach_plugins(component_manager.get()); - // Resolve all event sources now that all plugins have been loaded - component_manager->resolve_event_sources(); - // Give all components a JApplication pointer and a logger component_manager->configure_components(); + // Resolve all event sources now that all plugins have been loaded + component_manager->resolve_event_sources(); + // Set desired nthreads. We parse the 'nthreads' parameter two different ways for backwards compatibility. m_desired_nthreads = 1; m_params->SetDefaultParameter("nthreads", m_desired_nthreads, "Desired number of worker threads, or 'Ncores' to use all available cores."); From 45589d5574da8cd48ea3f3a5532f16a5fd5d8093 Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Wed, 1 May 2024 00:15:00 -0400 Subject: [PATCH 2/3] Fix more breakages when running inside eic-shell --- src/examples/TimesliceExample/MyFileReader.h | 2 +- src/plugins/JTestRoot/JTestRootEventSource.h | 2 +- src/plugins/JTestRoot/JTestRootProcessor.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/examples/TimesliceExample/MyFileReader.h b/src/examples/TimesliceExample/MyFileReader.h index 84f85c174..fb5985c22 100644 --- a/src/examples/TimesliceExample/MyFileReader.h +++ b/src/examples/TimesliceExample/MyFileReader.h @@ -21,7 +21,7 @@ struct MyFileReader : public JEventSource { void Close() override { } - Result Emit(JEvent&) override { + Result Emit(JEvent& event) override { auto event_nr = event.GetEventNumber(); diff --git a/src/plugins/JTestRoot/JTestRootEventSource.h b/src/plugins/JTestRoot/JTestRootEventSource.h index 1a41f3930..fba3dd6a9 100644 --- a/src/plugins/JTestRoot/JTestRootEventSource.h +++ b/src/plugins/JTestRoot/JTestRootEventSource.h @@ -12,7 +12,7 @@ class JTestRootEventSource : public JEventSource { public: - JTestRootEventSource(std::string resource_name, JApplication* app); + JTestRootEventSource(); virtual ~JTestRootEventSource() = default; Result Emit(JEvent& event) override; diff --git a/src/plugins/JTestRoot/JTestRootProcessor.cc b/src/plugins/JTestRoot/JTestRootProcessor.cc index 3e53c0cb0..6178d22a9 100644 --- a/src/plugins/JTestRoot/JTestRootProcessor.cc +++ b/src/plugins/JTestRoot/JTestRootProcessor.cc @@ -19,7 +19,7 @@ JTestRootProcessor::JTestRootProcessor() { SetCallbackStyle(CallbackStyle::ExpertMode); } -void JTestRootProcessor::Process(const JEvent&) { +void JTestRootProcessor::Process(const JEvent& event) { // Get the cluster objects auto clusters = event.Get(); From be3d29d8966a1f77279191f6a9191b999600edad Mon Sep 17 00:00:00 2001 From: Nathan Brei Date: Wed, 1 May 2024 01:15:56 -0400 Subject: [PATCH 3/3] Fix issue #291 --- src/libraries/JANA/Services/JPluginLoader.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/JANA/Services/JPluginLoader.cc b/src/libraries/JANA/Services/JPluginLoader.cc index f654ffae3..78c3881b2 100644 --- a/src/libraries/JANA/Services/JPluginLoader.cc +++ b/src/libraries/JANA/Services/JPluginLoader.cc @@ -219,8 +219,9 @@ void JPluginLoader::attach_plugin(std::string soname) { // Open shared object void* handle = dlopen(soname.c_str(), RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE); if (!handle) { - LOG_DEBUG(m_logger) << dlerror() << LOG_END; - throw JException("Plugin dlopen() failed: %s", dlerror()); + std::string err = dlerror(); + LOG_DEBUG(m_logger) << "Plugin dlopen() failed: " << err << LOG_END; + throw JException("Plugin dlopen() failed: %s", err.c_str()); } // Look for an InitPlugin symbol