// Look for items in the active list that don't have their dependencies filled // anymore. // // POST: Any elements in active with dependencies not filled are added to the // the pending list. (A remove and an add are added to the pending). // RETURNS: The number of lost dependencies found. int ConfigManager::scanForLostDependencies() { vprASSERT(0 == mActiveLock.test()); // We can't hold the lock upon entry vpr::DebugOutputGuard og(vprDBG_ALL, vprDBG_CONFIG_LVL, "ConfigManager::scanForLostDependencies()\n", "ConfigManager::scanForLostDependencies() done.\n"); DependencyManager* dep_mgr = DependencyManager::instance(); std::vector<ConfigElementPtr> elements; int num_lost_deps(0); // NOTE: can't hold this lock because the isSatisfied routines make // use of the activeLock as well // NOTE: Make the copy of the elements so that we can iterate without // fear of active changing mActiveLock.acquire(); elements = mActiveConfig.vec(); // Get a copy of the elements mActiveLock.release(); // Now test them for ( unsigned int i=0;i<elements.size();i++ ) { if ( !dep_mgr->isSatisfied(elements[i]) ) // We are not satisfied { vprDEBUG_NEXT(vprDBG_ALL, vprDBG_WARNING_LVL) << elements[i]->getName() << " type: " << elements[i]->getID() << " has lost dependencies.\n" << vprDEBUG_FLUSH; num_lost_deps++; // Keep a count of the number lost deps found // Add the pending removal PendingElement pending; pending.mType = PendingElement::REMOVE; pending.mElement = elements[i]; vprASSERT(1 == mPendingLock.test()); addPending(pending); // Add the pending re-addition // ConfigElementPtr copy_of_element; // Need a copy so that the remove can delete the element // copy_of_element = new ConfigElement(*elements[i]); pending.mType = PendingElement::ADD; pending.mElement = elements[i];//copy_of_element; vprASSERT(1 == mPendingLock.test()); addPending(pending); // Add the add item } } return num_lost_deps; }
bool doCircle() { int curPRI,curINT; if(!eventUpdate()) return false; if(get_faultmask()) curPRI = -1; else if(get_primask()) curPRI = 0; else if(get_basepri()) curPRI = get_basepri(); else if(getMode()){ curINT = NVIC_ICSR_getINT(); curPRI = NVIC_getPriority(curINT); } else curPRI = 500; if(curPRI <= Pending->nextINT->priority) return false; if(curPRI != 500){ addPending(curINT,1); NVIC_setPend(curINT); NVIC_clrActive(curINT); } curINT = Pending->nextINT->INT_ID; delPending(curINT); NVIC_clrPend(curINT); NVIC_setActive(curINT); NVIC_ICSR_setINT(curINT); return true; }
Asset* AssetSystem::get(const char* pFileName) { Asset* pAsset = addPending(pFileName); if (pAsset && !pAsset->getLoaded()) { pAsset->load(); } return pAsset; }
void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) { // You should only get this message if the cache is at the simulator // level, hence having an upstream provider. if (!mUpstreamHost.isOk()) { llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl; return; } LLHost fromHost = msg->getSender(); ReplySender sender(msg); S32 count = msg->getNumberOfBlocksFast(_PREHASH_UUIDNameBlock); for(S32 i = 0; i < count; ++i) { LLUUID id; msg->getUUIDFast(_PREHASH_UUIDNameBlock, _PREHASH_ID, id, i); LLCacheNameEntry* entry = get_ptr_in_map(mCache, id); if(entry) { if (isGroup != entry->mIsGroup) { llwarns << "LLCacheName - Asked for " << (isGroup ? "group" : "user") << " name, " << "but found " << (entry->mIsGroup ? "group" : "user") << ": " << id << llendl; } else { // ...it's in the cache, so send it as the reply sender.send(id, *entry, fromHost); } } else { if (!isRequestPending(id)) { if (isGroup) { mAskGroupQueue.insert(id); } else { mAskNameQueue.insert(id); } } addPending(id, fromHost); } } }
void HudGaugeMessages::processMessageBuffer() { int sw, x, offset = 0; size_t i; char *msg; char *split_str, *ptr; for ( i = 0; i < HUD_msg_buffer.size(); i++ ) { msg = new char [HUD_msg_buffer[i].text.size()+1]; strcpy(msg, HUD_msg_buffer[i].text.c_str()); ptr = strstr(msg, NOX(": ")) + 2; if ( ptr ) { gr_get_string_size(&sw, NULL, msg, (int)(ptr - msg)); offset = sw; } x = 0; split_str = msg; while ((ptr = split_str_once(split_str, Max_width - x - 7)) != NULL) { // the 7 is a fudge hack // make sure that split went ok, if not then bail if (ptr == split_str) { break; } addPending(split_str, HUD_msg_buffer[i].source, x); split_str = ptr; x = offset; } addPending(split_str, HUD_msg_buffer[i].source, x); delete[] msg; } }