// Disposes a clauses and removes it from watcher lists. NOTE! Low-level; does NOT change the 'clauses' and 'learnts' vector. // void Solver::remove(Clause* c, bool just_dealloc) { if (!just_dealloc){ if (c->size() == 2) removeWatch(watches[index(~(*c)[0])], GClause_new((*c)[1])), removeWatch(watches[index(~(*c)[1])], GClause_new((*c)[0])); else removeWatch(watches[index(~(*c)[0])], GClause_new(c)), removeWatch(watches[index(~(*c)[1])], GClause_new(c)); } if (c->learnt()) stats.learnts_literals -= c->size(); else stats.clauses_literals -= c->size(); xfree(c); }
void OSEventThread::processReadReadies(fd_set * rfds, int n) { TRACE("~~~~ +processReadReadies (%d) ~~~~\n", n); OSMutexLocker _locker(&mMutex); event_req_t* rev = UT_LIST_GET_FIRST(mWatchList); event_req_t* next; while((NULL != rev) && (n > 0)){ next = UT_LIST_GET_NEXT(watchNode,rev); if (FD_ISSET(rev->fd, rfds)) { rev->status = 1; UT_LIST_ADD_FIRST(activeNode,mPendingList,rev); if (rev->persist == false) { removeWatch(rev); DecreaseWatchNum(); } n--; } rev = next; } TRACE("~~~~ -processReadReadies (%d) ~~~~\n", n); }
void NetworkConnection::addBlock(PlayerListing * player) { if(player->friendWatchType == PlayerListing::friended) removeFriend(player); else if(player->friendWatchType == PlayerListing::watched) removeWatch(player); player->friendWatchType = PlayerListing::blocked; blockedList.push_back(new FriendWatchListing(player->name)); }
static void watchToggled(DBusWatch *watch, void *data) { (void)data; DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("watchToggled called "), DLT_INT64( (long)watch) ); if(dbus_watch_get_enabled(watch)) addWatch(watch, data); else removeWatch(watch, data); }
//-------- void FileWatcherOSX::removeWatch(const String& directory) { WatchMap::iterator iter = mWatches.begin(); WatchMap::iterator end = mWatches.end(); for(; iter != end; ++iter) { if(directory == iter->second->mDirName) { removeWatch(iter->first); return; } } }
/* Note that these can't be called if the listing already has * the bit set and server side friends lists will have a * separate interface */ void NetworkConnection::addFriend(PlayerListing * player) { if(player->friendWatchType == PlayerListing::blocked) removeBlock(player); else if(player->friendWatchType == PlayerListing::watched) removeWatch(player); player->friendWatchType = PlayerListing::friended; //FIXME presumably they're not already on the list because //the popup checked that in constructing the popup menu but... friendedList.push_back(new FriendWatchListing(player->name, friendwatch_notify_default)); emit playerListingReceived(player); }
void FileWatcherWin32::removeWatch(const mxChar* directory) { WatchMap::Iterator iter( mWatches ); while( iter ) { if( mxStrEqu( directory, iter.Value()->mDirName.ToChars() ) ) { removeWatch( iter.Key() ); return; } ++iter; } }
void FileWatcherWin32::removeWatch(const std::string& directory) { mWatchesLock.lock(); WatchVector::iterator iter = mWatches.begin(); for(; iter != mWatches.end(); ++iter) { if(directory == (*iter)->Watch->DirName) { removeWatch((*iter)->Watch->ID); break; } } mWatchesLock.unlock(); }
void AutoUpdateManager::onFileChanged(const QString& local_path) { qDebug("[AutoUpdateManager] detected cache file %s changed", local_path.toUtf8().data()); if (!watch_infos_.contains(local_path)) { // filter unwanted events return; } WatchedFileInfo &info = watch_infos_[local_path]; QFileInfo finfo(local_path); // Download the doc file in the mac will automatically upload // If the timestamp has not changed, it will not be uploaded qint64 mtime = finfo.lastModified().toMSecsSinceEpoch(); if (mtime == info.mtime) { qDebug("[AutoUpdateManager] Received a file %s upload notification, but the timestamp has not changed, " "it will not upload", local_path.toUtf8().data()); return; } #ifdef Q_OS_MAC if (MacImageFilesWorkAround::instance()->isRecentOpenedImage(local_path)) { qDebug("[AutoUpdateManager] skip the image file updates on mac for %s", toCStr(local_path)); return; } #endif removePath(&watcher_, local_path); QString repo_id, path_in_repo; if (!finfo.exists()) { qDebug("[AutoUpdateManager] detected cache file %s renamed or removed", local_path.toUtf8().data()); WatchedFileInfo deferred_info = info; removeWatch(local_path); // Some application would deleted and recreate the file when saving. // We work around that by double checking whether the file gets // recreated after a short period QTimer::singleShot(5000, this, SLOT(checkFileRecreated())); deleted_files_infos_.enqueue(deferred_info); return; } uploadFile(local_path); }
/*_________________________________________________________________________________________________ | | simplifyDB : [void] -> [bool] | | Description: | Simplify the clause database according to the current top-level assigment. Currently, the only | thing done here is the removal of satisfied clauses, but more things can be put here. |________________________________________________________________________________________________@*/ void Solver::simplifyDB() { if (!ok) return; // GUARD (public method) assert(decisionLevel() == 0); if (propagate() != NULL){ ok = false; return; } if (nAssigns() == simpDB_assigns || simpDB_props > 0) // (nothing has changed or preformed a simplification too recently) return; // Clear watcher lists: for (int i = simpDB_assigns; i < nAssigns(); i++){ Lit p = trail[i]; vec<GClause>& ws = watches[index(~p)]; for (int j = 0; j < ws.size(); j++) if (ws[j].isLit()) if (removeWatch(watches[index(~ws[j].lit())], GClause_new(p))) // (remove binary GClause from "other" watcher list) n_bin_clauses--; watches[index( p)].clear(true); watches[index(~p)].clear(true); } // Remove satisfied clauses: for (int type = 0; type < 2; type++){ vec<Clause*>& cs = type ? learnts : clauses; int j = 0; for (int i = 0; i < cs.size(); i++){ if (!locked(cs[i]) && simplify(cs[i])) // (the test for 'locked()' is currently superfluous, but without it the reason-graph is not correctly maintained for decision level 0) remove(cs[i]); else cs[j++] = cs[i]; } cs.shrink(cs.size()-j); } simpDB_assigns = nAssigns(); simpDB_props = stats.clauses_literals + stats.learnts_literals; // (shouldn't depend on 'stats' really, but it will do for now) }
// Remove event from watch or timer list void OSEventThread::DelEvent(event_req_t * ev) { TRACE("~~~~ +DelEvent ~~~~\n"); if(!ev) return; { OSMutexLocker _locker(&mMutex); if(NULL != UT_LIST_GET_NEXT(watchNode,ev) || NULL != UT_LIST_GET_PREV(watchNode,ev)) { removeWatch(ev); DecreaseWatchNum(); } } wakeup(); while (ev->status != 0)//just for single thread { WARN("wait exit from pending list \n"); OSThread::Sleep(1); } TRACE("~~~~ -DelEvent ~~~~\n"); }
Error processEvent(FileEventContext* pContext, struct inotify_event* pEvent, std::vector<FileChangeEvent>* pFileChanges) { // determine event type FileChangeEvent::Type eventType = FileChangeEvent::None; if (pEvent->mask & IN_CREATE) eventType = FileChangeEvent::FileAdded; else if (pEvent->mask & IN_DELETE) eventType = FileChangeEvent::FileRemoved; else if (pEvent->mask & IN_MODIFY) eventType = FileChangeEvent::FileModified; else if (pEvent->mask & IN_MOVED_TO) eventType = FileChangeEvent::FileAdded; else if (pEvent->mask & IN_MOVED_FROM) eventType = FileChangeEvent::FileRemoved; // return event if we got a valid event type and the event applies to a // child of the monitored directory (len == 0 occurs for root element) if ((eventType != FileChangeEvent::None) && (pEvent->len > 0)) { // find the FileInfo for this wd (ignore if we can't find one) Watch watch = pContext->watches.find(pEvent->wd); if (watch.empty()) return Success(); // get an iterator to the parent dir tree<FileInfo>::iterator parentIt = impl::findFile( pContext->fileTree.begin(), pContext->fileTree.end(), watch.path); // if we can't find a parent then return (this directory may have // been excluded from scanning due to a filter) if (parentIt == pContext->fileTree.end()) return Success(); // get file info FilePath filePath = FilePath(parentIt->absolutePath()).complete( pEvent->name); // if the file exists then collect as many extended attributes // as necessary -- otherwise just record path and dir status FileInfo fileInfo; if (filePath.exists()) { fileInfo = FileInfo(filePath, filePath.isSymlink()); } else { fileInfo = FileInfo(filePath.absolutePath(), pEvent->mask & IN_ISDIR); } // if this doesn't meet the filter then ignore if (pContext->filter && !pContext->filter(fileInfo)) return Success(); // handle the various types of actions switch(eventType) { case FileChangeEvent::FileRemoved: { // generate events FileChangeEvent event(FileChangeEvent::FileRemoved, fileInfo); std::vector<FileChangeEvent> removeEvents; impl::processFileRemoved(parentIt, event, pContext->recursive, &pContext->fileTree, &removeEvents); // for each directory remove event remove any watches we have for it BOOST_FOREACH(const FileChangeEvent& event, removeEvents) { if (event.fileInfo().isDirectory()) { Watch watch = pContext->watches.find( event.fileInfo().absolutePath()); if (!watch.empty()) { removeWatch(pContext->fd, watch); pContext->watches.erase(watch); } } } // copy to the target events std::copy(removeEvents.begin(), removeEvents.end(), std::back_inserter(*pFileChanges)); break; } case FileChangeEvent::FileAdded: { FileChangeEvent event(FileChangeEvent::FileAdded, fileInfo); Error error = impl::processFileAdded(parentIt, event, pContext->recursive, pContext->filter, addWatchFunction(pContext), &pContext->fileTree, pFileChanges); // log the error if it wasn't no such file/dir (this can happen // in the normal course of business if a file is deleted between // the time the change is detected and we try to inspect it) if (error && (error.code() != boost::system::errc::no_such_file_or_directory)) { LOG_ERROR(error); } break; } case FileChangeEvent::FileModified: { FileChangeEvent event(FileChangeEvent::FileModified, fileInfo); impl::processFileModified(parentIt, event, &pContext->fileTree, pFileChanges); break; } case FileChangeEvent::None: break; } }
void Inotify::unwatchFile(fs::path file) { removeWatch(mDirectorieMap.right.at(file)); }
void QReliableFileWatch::removeWatch(QObject *recipient) { removeWatch(QString(), recipient); }