1717#include " Framework/DataProcessor.h"
1818#include " Framework/DataSpecUtils.h"
1919#include " Framework/DeviceState.h"
20+ #include " Framework/DeviceStateEnums.h"
2021#include " Framework/DispatchPolicy.h"
2122#include " Framework/DispatchControl.h"
2223#include " Framework/DanglingContext.h"
@@ -196,11 +197,10 @@ struct locked_execution {
196197 ~locked_execution () { ref.unlock (); }
197198};
198199
199- DataProcessingDevice::DataProcessingDevice (RunningDeviceRef running, ServiceRegistry& registry, ProcessingPolicies& policies )
200+ DataProcessingDevice::DataProcessingDevice (RunningDeviceRef running, ServiceRegistry& registry)
200201 : mRunningDevice {running},
201202 mConfigRegistry {nullptr },
202- mServiceRegistry {registry},
203- mProcessingPolicies {policies}
203+ mServiceRegistry {registry}
204204{
205205 GetConfig ()->Subscribe <std::string>(" dpl" , [®istry = mServiceRegistry ](const std::string& key, std::string value) {
206206 if (key == " cleanup" ) {
@@ -247,6 +247,7 @@ DataProcessingDevice::DataProcessingDevice(RunningDeviceRef running, ServiceRegi
247247 mHandles .resize (1 );
248248
249249 ServiceRegistryRef ref{mServiceRegistry };
250+
250251 mAwakeHandle = (uv_async_t *)malloc (sizeof (uv_async_t ));
251252 auto & state = ref.get <DeviceState>();
252253 assert (state.loop );
@@ -1189,18 +1190,18 @@ void DataProcessingDevice::fillContext(DataProcessorContext& context, DeviceCont
11891190 errorCallback (errorContext);
11901191 };
11911192 } else {
1192- context.errorHandling = [&errorPolicy = mProcessingPolicies .error ,
1193- &serviceRegistry = mServiceRegistry ](RuntimeErrorRef e, InputRecord& record) {
1193+ context.errorHandling = [&serviceRegistry = mServiceRegistry ](RuntimeErrorRef e, InputRecord& record) {
11941194 auto & err = error_from_ref (e);
11951195 // / FIXME: we should pass the salt in, so that the message
11961196 // / can access information which were stored in the stream.
11971197 ServiceRegistryRef ref{serviceRegistry, ServiceRegistry::globalDeviceSalt ()};
11981198 auto & context = ref.get <DataProcessorContext>();
1199+ auto & deviceContext = ref.get <DeviceContext>();
11991200 O2_SIGNPOST_ID_FROM_POINTER (cid, device, &context);
12001201 BacktraceHelpers::demangled_backtrace_symbols (err.backtrace , err.maxBacktrace , STDERR_FILENO);
12011202 auto & stats = ref.get <DataProcessingStats>();
12021203 stats.updateStats ({(int )ProcessingStatsId::EXCEPTION_COUNT, DataProcessingStats::Op::Add, 1 });
1203- switch (errorPolicy ) {
1204+ switch (deviceContext. processingPolicies . error ) {
12041205 case TerminationPolicy::QUIT:
12051206 O2_SIGNPOST_EVENT_EMIT_ERROR (device, cid, " Run" , " Exception while running: %{public}s. Rethrowing." , err.what );
12061207 throw e;
@@ -1211,10 +1212,10 @@ void DataProcessingDevice::fillContext(DataProcessorContext& context, DeviceCont
12111212 };
12121213 }
12131214
1214- auto decideEarlyForward = [&context, &spec, this ]() -> bool {
1215+ auto decideEarlyForward = [&context, &deviceContext, & spec, this ]() -> bool {
12151216 // / We must make sure there is no optional
12161217 // / if we want to optimize the forwarding
1217- bool canForwardEarly = (spec.forwards .empty () == false ) && mProcessingPolicies .earlyForward != EarlyForwardPolicy::NEVER;
1218+ bool canForwardEarly = (spec.forwards .empty () == false ) && deviceContext. processingPolicies .earlyForward != EarlyForwardPolicy::NEVER;
12181219 bool onlyConditions = true ;
12191220 bool overriddenEarlyForward = false ;
12201221 for (auto & forwarded : spec.forwards ) {
@@ -1229,7 +1230,7 @@ void DataProcessingDevice::fillContext(DataProcessorContext& context, DeviceCont
12291230 break ;
12301231 }
12311232#endif
1232- if (DataSpecUtils::partialMatch (forwarded.matcher , o2::header::DataDescription{" RAWDATA" }) && mProcessingPolicies .earlyForward == EarlyForwardPolicy::NORAW) {
1233+ if (DataSpecUtils::partialMatch (forwarded.matcher , o2::header::DataDescription{" RAWDATA" }) && deviceContext. processingPolicies .earlyForward == EarlyForwardPolicy::NORAW) {
12331234 context.canForwardEarly = false ;
12341235 overriddenEarlyForward = true ;
12351236 LOG (detail) << " Cannot forward early because of RAWDATA input: " << DataSpecUtils::describe (forwarded.matcher );
@@ -1560,7 +1561,7 @@ void DataProcessingDevice::Run()
15601561 }
15611562 }
15621563
1563- O2_SIGNPOST_END (device, lid, " run_loop" , " Run loop completed. Transition handling state %d." , state.transitionHandling );
1564+ O2_SIGNPOST_END (device, lid, " run_loop" , " Run loop completed. Transition handling state %d." , ( int ) state.transitionHandling );
15641565 auto & spec = ref.get <DeviceSpec const >();
15651566 // / Cleanup messages which are still pending on exit.
15661567 for (size_t ci = 0 ; ci < spec.inputChannels .size (); ++ci) {
0 commit comments