void Aggregate::splitter() try { // Check if any of the Chunk is splittable while (!isComplete() && !hasFailed()) { RemoteData::Partial p = isSplittable(); if(p == RemoteData::Partial::no) return; else if(p==RemoteData::Partial::yes) break; boost::this_thread::sleep(boost::posix_time::millisec(100)); } // Loop while a bottleneck exists while (!isComplete() && !hasFailed()) { // Get the bottle neck and split if(activeChunks() < m_chunks && isSplitReady() ) { // NOTE: Removing this showed the synronization bug std::vector<Chunk*>::size_type bneck = bottleNeck(); split(bneck); // Just sleep for a while boost::this_thread::sleep(boost::posix_time::millisec(1000)); } boost::this_thread::sleep(boost::posix_time::millisec(100)); } } catch (ex::aggregator::NoBottleneck e) { // This isn't a bad thing, just signifies // that no further segmentation can occur. // It helps to get outside both of splitting // loops. }
void MockCheckedActualCall::failTest(const MockFailure& failure) { if (!hasFailed()) { setState(CALL_FAILED); reporter_->failTest(failure); } }
Goal<ZeldaEntity>::Status Goal_MoveToPosition::process(const sf::Time& dt) { if (isInactive()) { activate(); } setStatus(processSubgoals(dt)); if (hasFailed()) { activate(); } return getStatus(); }
void Aggregate::speed_worker() { const double refresh = 0.1; const unsigned persistance = 1/refresh*5; uintmax_t no = 0; while (!isComplete() && !hasFailed()){ boost::this_thread::sleep(boost::posix_time::millisec(refresh*1000)); m_instSpeed = aggregateSpeed(); m_avgSpeed= (m_avgSpeed*no+m_instSpeed)/(no+1); int per = (no < persistance)?no:persistance; m_hifiSpeed= (m_hifiSpeed*per+m_instSpeed)/(per+1); no++; } m_instSpeed = 0; m_avgSpeed = 0; m_hifiSpeed = 0; }
void MockCheckedActualCall::checkOutputParameter(const MockNamedValue& outputParameter) { if(hasFailed()) { return; } callIsInProgress(); unfulfilledExpectations_.onlyKeepExpectationsWithOutputParameter(outputParameter); if (unfulfilledExpectations_.isEmpty()) { MockUnexpectedOutputParameterFailure failure(getTest(), getName(), outputParameter, allExpectations_); failTest(failure); return; } unfulfilledExpectations_.outputParameterWasPassed(outputParameter.getName()); finalizeCallWhenFulfilled(); }