From 73530260b56b7b129c41481f0ad0d99fe16149ee Mon Sep 17 00:00:00 2001 From: Owen Green Date: Mon, 1 Jun 2020 23:00:25 +0100 Subject: [PATCH] Toughen checks for job status now that start time is decoupled from construction More toughening of threads vs triggers --- include/FluidSCWrapper.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/FluidSCWrapper.hpp b/include/FluidSCWrapper.hpp index 93a1734..11aad2a 100644 --- a/include/FluidSCWrapper.hpp +++ b/include/FluidSCWrapper.hpp @@ -358,9 +358,12 @@ public: bool trigger = (mPreviousTrigger <= 0) && triggerInput > 0; mPreviousTrigger = triggerInput; - if(trigger) mWorld->ft->fSendMsgFromRT(mWorld, mFifoMsg); + if(trigger) + { + mWorld->ft->fSendMsgFromRT(mWorld, mFifoMsg); + } - if (0 == pollCounter++ && !mCheckingForDone) + if (0 == pollCounter++ && !mCheckingForDone && mHasTriggered) { mCheckingForDone = true; mWorld->ft->fDoAsynchronousCommand(mWorld, nullptr, Wrapper::getName(), @@ -391,6 +394,7 @@ public: w->mClient.setSynchronous(w->mSynchronous); w->mClient.enqueue(w->mParams); w->mResult = w->mClient.process(); + w->mHasTriggered = true; } /// Check result and report if bad @@ -419,16 +423,21 @@ public: std::cout << Wrapper::getName() << ": Processing cancelled" << std::endl; w->mCancelled = true; + w->mHasTriggered = false; + w->mJobDone = true; return false; } if (!r.ok()) { - std::cout << "ERROR: " << Wrapper::getName() << ": " + if(!w->mDone) + std::cout << "ERROR: " << Wrapper::getName() << ": " << r.message().c_str() << std::endl; + w->mJobDone = true; + w->mHasTriggered = false; return false; } - + w->mHasTriggered = false; w->mJobDone = true; return true; } @@ -523,6 +532,7 @@ private: bool mCheckingForDone{false}; // only write to this from RT thread kthx bool mCancelled{false}; bool mJobDone{false}; + bool mHasTriggered{false}; Wrapper* mWrapper{static_cast(this)}; Result mResult; };