bool RDOPROCSeize::onCheckCondition(const LPRDORuntime& pRuntime) { if (m_transacts.empty()) return false; const std::size_t Size_Seizes = forRes.size(); for (std::size_t i = 0; i < Size_Seizes; i++) { // если свободен if (forRes[i].rss->getParam(forRes[i].Id_param) == forRes[i].enum_free) { const std::size_t idBlocksTransact = m_transacts.front()->getTraceID(); const std::size_t idResourcesTransact = forRes[i].rss->transacts.front()->getTraceID(); if (idBlocksTransact != idResourcesTransact) return false; RDOTrace* tracer = pRuntime->getTracer(); forRes[i].rss->setParam(forRes[i].Id_param, forRes[i].enum_buzy); TRACE3("%7.1f SEIZES-%d, resId = %d\n", pRuntime->getCurrentTime(), index, forRes[i].rss->getTraceID()); if (!tracer->isNull()) tracer->getOStream() << forRes[i].rss->traceResourceState('\0', pRuntime) << tracer->getEOL(); m_transacts.front()->setRes(forRes[i].rss); return true; } } return false; }
bool RDOPROCRelease::onCheckCondition(const LPRDORuntime& pRuntime) { if (!m_transacts.empty()) { int Size_Seizes = forRes.size(); for(int i=0;i<Size_Seizes; i++) { if(forRes[i].rss == m_transacts.front()->getRes()) { // Занят if (forRes[i].rss->getParam(forRes[i].Id_param) == forRes[i].enum_buzy) { RDOTrace* tracer = pRuntime->getTracer(); TRACE3("%7.1f RELEASES-%d, resId = %d\n", pRuntime->getCurrentTime(), index, forRes[i].rss->getTraceID()); forRes[i].rss->setParam(forRes[i].Id_param, forRes[i].enum_free); if (!tracer->isNull()) { tracer->getOStream() << forRes[i].rss->traceResourceState('\0', pRuntime) << tracer->getEOL(); } return true; } // Не Занят и не свободен if (forRes[i].rss->getParam(forRes[i].Id_param) != forRes[i].enum_free) { //Удаляем транзакт RDOTrace* tracer = pRuntime->getTracer(); TRACE3("%7.1f RELEASES_Bad-%d, resId = %d\n", pRuntime->getCurrentTime(), index, forRes[i].rss->getTraceID()); LPRDOPROCTransact transact = m_transacts.front(); ASSERT(transact); transact->setState(RDOResource::CS_Erase); if (!tracer->isNull()) { tracer->getOStream() << transact->traceResourceState('\0', pRuntime) << tracer->getEOL(); } m_transacts.remove(transact); forRes[i].rss->transacts.remove(transact); pRuntime->onEraseRes(transact->getTraceID(), NULL); return false; } } } } return false; }
void RDORuntime::copyFrom(const LPRDORuntime& pOther) { ASSERT(pOther); ASSERT(m_resourceTypeList.empty()); LPRDORuntime pThis(const_cast<RDORuntime*>(this)); for (const LPRDOResourceTypeList& pRTP: pOther->m_resourceTypeList) { pRTP->clone(pThis); } m_constantList = pOther->m_constantList; m_patternParameterList = pOther->m_patternParameterList; m_resultList = pOther->m_resultList; m_pThreadProxy = pOther->m_pThreadProxy; setCurrentTime(pOther->getCurrentTime()); parent_type::copyFrom(pOther.object_parent_cast<parent_type>()); }