@@ -156,6 +156,9 @@ void GPURecoWorkflowSpec::finalizeInputPipelinedJob(GPUTrackingInOutPointers* pt
156156
157157int GPURecoWorkflowSpec::handlePipeline (ProcessingContext& pc, GPUTrackingInOutPointers& ptrs, GPURecoWorkflowSpec_TPCZSBuffers& tpcZSmeta, o2::gpu::GPUTrackingInOutZS& tpcZS, std::unique_ptr<GPURecoWorkflow_QueueObject>& context)
158158{
159+ mPipeline ->runStarted = true ;
160+ mPipeline ->stateNotify .notify_all ();
161+
159162 auto * device = pc.services ().get <RawDeviceService>().device ();
160163 const auto & tinfo = pc.services ().get <o2::framework::TimingInfo>();
161164 if (mSpecConfig .enableDoublePipeline == 1 ) {
@@ -239,11 +242,8 @@ int GPURecoWorkflowSpec::handlePipeline(ProcessingContext& pc, GPUTrackingInOutP
239242void GPURecoWorkflowSpec::handlePipelineEndOfStream (EndOfStreamContext& ec)
240243{
241244 if (mSpecConfig .enableDoublePipeline == 1 ) {
242- {
243- std::lock_guard lk (mPipeline ->fmqStateMutex );
244- mPipeline ->endOfStreamReceived = true ;
245- }
246- mPipeline ->fmqStateCheckNotify .notify_all ();
245+ mPipeline ->endOfStreamReceived = true ;
246+ mPipeline ->stateNotify .notify_all ();
247247 }
248248 if (mSpecConfig .enableDoublePipeline == 2 ) {
249249 auto * device = ec.services ().get <RawDeviceService>().device ();
@@ -260,7 +260,7 @@ void GPURecoWorkflowSpec::handlePipelineEndOfStream(EndOfStreamContext& ec)
260260void GPURecoWorkflowSpec::receiveFMQStateCallback (fair::mq::State newState)
261261{
262262 {
263- std::lock_guard lk (mPipeline ->fmqStateMutex );
263+ std::lock_guard lk (mPipeline ->stateMutex );
264264 if (mPipeline ->fmqState != fair::mq::State::Running && newState == fair::mq::State::Running) {
265265 mPipeline ->endOfStreamReceived = false ;
266266 }
@@ -269,7 +269,7 @@ void GPURecoWorkflowSpec::receiveFMQStateCallback(fair::mq::State newState)
269269 mPipeline ->fmqDevice ->UnsubscribeFromStateChange (GPURecoWorkflowSpec_FMQCallbackKey);
270270 }
271271 }
272- mPipeline ->fmqStateCheckNotify .notify_all ();
272+ mPipeline ->stateNotify .notify_all ();
273273}
274274
275275void GPURecoWorkflowSpec::RunReceiveThread ()
@@ -282,8 +282,8 @@ void GPURecoWorkflowSpec::RunReceiveThread()
282282 LOG (debug) << " Waiting for out of band message" ;
283283 do {
284284 {
285- std::unique_lock lk (mPipeline ->fmqStateMutex );
286- mPipeline ->fmqStateCheckNotify .wait (lk, [this ]() { return (mPipeline ->fmqState == fair::mq::State::Running && !mPipeline ->endOfStreamReceived ) || mPipeline ->shouldTerminate ; }); // Do not check mPipeline->fmqDevice->NewStatePending() since we wait for EndOfStream!
285+ std::unique_lock lk (mPipeline ->stateMutex );
286+ mPipeline ->stateNotify .wait (lk, [this ]() { return (mPipeline -> runStarted && mPipeline ->fmqState == fair::mq::State::Running && !mPipeline ->endOfStreamReceived ) || mPipeline ->shouldTerminate ; }); // Do not check mPipeline->fmqDevice->NewStatePending() since we wait for EndOfStream!
287287 }
288288 if (mPipeline ->shouldTerminate ) {
289289 break ;
@@ -309,8 +309,10 @@ void GPURecoWorkflowSpec::RunReceiveThread()
309309 }
310310 if (m->flagEndOfStream ) {
311311 LOG (info) << " Received end-of-stream from out-of-band channel" ;
312+ std::lock_guard lk (mPipeline ->stateMutex );
312313 mPipeline ->endOfStreamReceived = true ;
313314 mPipeline ->mNTFReceived = 0 ;
315+ mPipeline ->runStarted = false ;
314316 continue ;
315317 }
316318
@@ -379,7 +381,7 @@ void GPURecoWorkflowSpec::ExitPipeline()
379381 if (mSpecConfig .enableDoublePipeline == 1 && mPipeline ->fmqDevice ) {
380382 mPipeline ->fmqDevice = nullptr ;
381383 mPipeline ->shouldTerminate = true ;
382- mPipeline ->fmqStateCheckNotify .notify_all ();
384+ mPipeline ->stateNotify .notify_all ();
383385 for (unsigned int i = 0 ; i < mPipeline ->workers .size (); i++) {
384386 mPipeline ->workers [i].inputQueueNotify .notify_one ();
385387 }
0 commit comments