pike.git / lib / modules / Filesystem.pmod / Monitor.pmod / basic.pike

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1:   //   // Basic filesystem monitor.   // - // $Id: basic.pike,v 1.3 2009/07/13 12:40:30 grubba Exp $ + // $Id: basic.pike,v 1.4 2009/07/14 16:14:07 grubba Exp $   //   // 2009-07-09 Henrik Grubbström   //      //! Basic filesystem monitor.   //!   //! This module is intended to be used for incremental scanning of   //! a filesystem.      //! The default maximum number of seconds between checks of directories
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:269:   //! @param file_interval_factor   //! Override of @[default_file_interval_factor] for this path   //! or subtree.   //!   //! @seealso   //! @[release()]   void monitor(string path, MonitorFlags|void flags,    int(0..)|void max_dir_check_interval,    int(0..)|void file_interval_factor)   { -  Monitor m = monitors[path] || -  Monitor(path, flags, max_dir_check_interval, file_interval_factor); +  path = combine_path(path, "."); +  Monitor m = monitors[path]; +  if (m) { +  if (!(flags & MF_AUTO)) { +  // The new monitor is added by hand. +  // Adjust the monitor. +  m->flags = flags; +  m->max_dir_check_interval = max_dir_check_interval; +  m->file_interval_factor = file_interval_factor; +  m->next_poll = 0; +  monitor_queue->adjust(m); +  } +  // For the other cases there's no need to do anything, +  // since we can keep the monitor as-is. +  } else { +  m = Monitor(path, flags, max_dir_check_interval, file_interval_factor);    monitors[path] = m;    monitor_queue->push(m);    } -  + }      //! Release a @[path] from monitoring.   //!   //! @param path   //! Path to stop monitoring.   //!   //! @param flags   //! @int   //! @value 0   //! Don't recurse.
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:295:   //! Release the entire subtree.   //! @value 3   //! Release the entire subtree, but only those paths that were   //! added automatically by a recursive monitor.   //! @endint   //!   //! @seealso   //! @[monitor()]   void release(string path, MonitorFlags|void flags)   { +  path = combine_path(path, ".");    Monitor m = m_delete(monitors, path);    if (m) {    release_monitor(m);    }    if (flags && m->st && m->st->isdir) {    path = combine_path(path, "");    foreach(monitors; string mpath; m) {    if (has_prefix(mpath, path) && ((m->flags & flags) == flags)) {    m_delete(monitors, mpath);    release_monitor(m);