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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:317:    int `<(mixed m) { return next_poll < m; }    int `>(mixed m) { return next_poll > m; }       void create()    {    MON_WERR("Creating monitor for %O.\n", path);    Element::create(this);    register_path(1);    }    +  //! Returns the parent monitor, or UNDEFINED if no such monitor exists. +  this_program parent() +  { +  string parent_path = canonic_path (dirname (path)); +  return monitors[parent_path]; +  } +  +  //! To be called when a (direct) submonitor is released. +  void submonitor_released (this_program submon) +  { +  if (files) { +  string filename = basename (submon->path); +  MON_WERR("%O->submonitor_released(%O): Removing list state for %O.\n", +  this, filename); +  files -= ({ filename }); +  } +  } +     //! Call a notification callback.    //!    //! @param cb    //! Callback to call or @[UNDEFINED] for no operation.    //!    //! @param path    //! Path to notify on.    //!    //! @param st    //! Stat for the @[path].
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:578:       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)    {    if ((this::flags & mask) == flags) { +  MON_WERR("Releasing in %O->check_for_release(%O, %O)\n", +  this, mask, flags);    m_delete(monitors, path);    release_monitor(this); -  +  if (this_program par = parent()) { +  par->submonitor_released (this); +  } else { +  MON_WERR("%O has no parent monitor.\n", this);    }    } -  +  }       //! Called to create a sub monitor.    protected void monitor(string path, int flags, int max_dir_interval,    int file_interval_factor, int stable_time)    {    global::monitor(path, flags, max_dir_check_interval,    file_interval_factor, stable_time);    }       //! Called when the status has changed for an existing file.