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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:433:    //! @param seconds    //! Number of seconds from now to run next scan. Defaults to    //! half of the remaining interval.    void bump(MonitorFlags|void flags, int|void seconds)    {    int now = time(1);    if (seconds)    next_poll = now + seconds;    else if (next_poll > now)    next_poll -= (next_poll - now) / 2; -  monitor_queue->adjust(this); +  adjust_monitor(this);       if ((flags & MF_RECURSE) && st->isdir && files) {    // Bump the files in the directory as well.    foreach(files, string file) {    file = canonic_path(Stdio.append_path(path, file));    Monitor m2 = monitors[file];    if (m2) {    m2->bump(flags, seconds);    }    }
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:485:    } else if (!st || !st->isdir) {    delta *= file_interval_factor || global::file_interval_factor;    }       if (!next_poll) {    // Attempt to distribute polls evenly at startup.    delta = 1 + random(delta);    }       next_poll = time(1) + (delta || 1); -  monitor_queue->adjust(this); +  adjust_monitor(this);    }       //! Check if this monitor should be removed automatically.    void check_for_release(int mask, int flags)    {    if ((this::flags & mask) == flags) {    m_delete(monitors, path);    release_monitor(this);    }    }
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:673:    // File deleted or changed type.       int delay;    // Propagate deletions to any submonitors.    if (files) {    foreach(files, string file) {    file = canonic_path(Stdio.append_path(path, file));    if (monitors[file]) {    // Adjust next_poll, so that the monitor will be checked soon.    monitors[file]->next_poll = time(1)-1; -  monitor_queue->adjust(monitors[file]); +  adjust_monitor(monitors[file]);    delay = 1;    }    }    }    if (delay) {    // Delay the notification until the submonitors have notified.    st = old_st;    next_poll = time(1); -  monitor_queue->adjust(this); +  adjust_monitor(this);    } else {    if (st) {    // Avoid race when a file has been replaced with a directory    // or vice versa or similar.    st = UNDEFINED;       // We will catch the new file at the next poll.    next_poll = time(1); -  monitor_queue->adjust(this); +  adjust_monitor(this);    } else {    // The monitor no longer has a link from its parent directory.    this::flags &= ~MF_HARD;       // Check if we should remove the monitor.    check_for_release(MF_AUTO, MF_AUTO);    }       file_deleted(path, old_st);    return 1;
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:875:    m->update(st);   }      //! Release a single @[Monitor] from monitoring.   //!   //! @seealso   //! @[release()]   protected void release_monitor(Monitor m)   {    m->next_poll = -1000; -  monitor_queue->adjust(m); +  adjust_monitor(m);    while (monitor_queue->peek() < 0)    monitor_queue->pop();   }    -  + //! Update the position in the @[monitor_queue] for the monitor @[m] + //! to account for an updated next_poll value. + protected void adjust_monitor(Monitor m) + { +  monitor_queue->adjust(m); + } +    //! Create a new @[Monitor] for a @[path].   //!   //! This function is called by @[monitor()] to create a new @[Monitor]   //! object.   //!   //! The default implementation just calls @[Monitor()] with the same   //! arguments.   //!   //! @seealso   //! @[monitor()]
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:949:    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->stable_time = stable_time;    m->next_poll = 0; -  monitor_queue->adjust(m); +  adjust_monitor(m);    }    if (flags & MF_HARD) {    m->flags |= MF_HARD;    }    // For the other cases there's no need to do anything,    // since we can keep the monitor as-is.    } else {    m = monitor_factory(path, flags, max_dir_check_interval,    file_interval_factor, stable_time);    monitors[path] = m;