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.19 2009/08/04 10:51:33 grubba Exp $ + // $Id: basic.pike,v 1.20 2009/08/05 13:06:15 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:176:       int `<(mixed m) { return next_poll < m; }    int `>(mixed m) { return next_poll > m; }       protected string _sprintf(int c)    {    return sprintf("Monitor(%O, %O, next: %s, st: %O)",    path, flags, ctime(next_poll) - "\n", st);    }    -  //! Calculate a suitable time for the next poll of this monitor. +  //! Calculate and set a suitable time for the next poll of this monitor.    //!    //! @param st    //! New stat for the monitor.    //!    //! This function is called by @[check()] to schedule the    //! next check.    protected void update(Stdio.Stat st)    {    int delta = max_dir_check_interval || global::max_dir_check_interval;    this_program::st = st;
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:202:    delta = 1 + random(delta);    }    if (st) {    int d = 1 + ((time(1) - st->mtime)>>4);    if (d < 0) d = max_dir_check_interval || global::max_dir_check_interval;    if (d < delta) delta = d;    d = 1 + ((time(1) - st->ctime)>>4);    if (d < 0) d = max_dir_check_interval || global::max_dir_check_interval;    if (d < delta) delta = d;    } +  if (last_change <= time(1)) { +  // Time until stable. +  d = last_change + (stable_time || global::stable_time) - time(1); +  d >>= 1; +  if (d < 0) d = 1; +  if (d < delta) delta = d; +  }    next_poll = time(1) + (delta || 1);    monitor_queue->adjust(this);    }       //! Check for changes.    //!    //! @param flags    //! @int    //! @value 0    //! Don't recurse.