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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:218:    int stable_time)   {    inherit ADT.Heap.Element;       int next_poll;    Stdio.Stat st;    int last_change = 0x7fffffff; // Future... Can be set to -0x7fffffff    // to indicate immediate stabilization    // (avoid an extra check() round to    // let the stat stabilize). +  private bool initialized = false;    array(string) files;       //! Event tracing callback.    //!    //! @param level    //! Severity level of the event.    //!    //! @param fun    //! Name of the function that called @[report()].    //!
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:476:    if (!st || !st->isdir) {    delta *= file_interval_factor || global::file_interval_factor;    }       if (st) {    // Start with a delta proportional to the time since mtime/ctime,    // but bound this to the max setting. A stat in the future will be    // adjusted to the max interval.    int mtime = max(st->mtime, st->ctime);    int d = ((time(1) - mtime) >> 2); -  if (!next_poll && (d >= 0)) { +  if (!initialized && (d >= 0)) {    // Assume that mtime is reasonable at startup.    last_change = mtime;    }    if ((d >= 0) && (d < delta)) delta = d;    }    if (last_change <= time(1)) {    // Time until stable.    int d = last_change + (stable_time || global::stable_time) - time(1);    d >>= 1;    if (d < 0) d = 1;    if (d < delta) delta = d;    } -  if (!next_poll) { +  if (!initialized) {    // Attempt to distribute polls evenly at startup, and to    // make sure that the full set of directory contents is    // found reasonably fast.    delta = 1 + random(delta >> 2); -  +  initialized = true;    }       MON_WERR("Next poll in %d seconds.\n", (delta || 1));    next_poll = time(1) + (delta || 1);    adjust_monitor(this);    }       //! Check if this monitor should be removed automatically.    void check_for_release(int mask, int flags)    {