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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:205:    MON_WERR("Registering %O for polling.\n", path);    mixed key = monitor_mutex->lock();    monitor_queue->push(this);    }    }       //! Unregister the @[Monitor] from the monitoring system.    //!    //! @param dying    //! Indicates that the @[Monitor] is being destructed. +  //! It is the destruction cause value offset by one.    protected void unregister_path(int|void dying)    { -  if (dying) { -  // We are going away permanently, so remove ourselves from -  // from the monitor_queue. -  MON_WERR("Unregistering %O from polling.\n", path); +  if (dying == 1) { +  // We are going away permanently due to explicit destruct(), +  // so remove ourselves from from the monitor_queue.    mixed key = monitor_mutex->lock(); -  +  MON_WERR("Unregistering %O from polling.\n", path);    monitor_queue->remove(this);    }    }       int `<(mixed m) { return next_poll < m; }    int `>(mixed m) { return next_poll > m; }       void create()    {    MON_WERR("Creating monitor for %O.\n", path);
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:733:    return 1;    } else if (last_change != 0x7fffffff) {    MON_WERR("Not stable yet. Age: %d seconds. Path: %O\n",    time(1) - last_change, path);    } else {    MON_WERR("Inode stable still.\n");    }    return 0;    }    -  protected void destroy() +  protected void destroy(int cause)    { -  unregister_path(1); +  // NB: Cause #0 == DESTRUCT_EXPLICIT. +  // Any other cause and unregistering is irrelevant. +  unregister_path(1 + cause);    }   }      //! @class DefaultMonitor   //! This symbol evaluates to the @[Monitor] class used by   //! the default implementation of @[monitor_factory()].   //!   //! It is currently one of the values @[Monitor], @[EventStreamMonitor]   //! or @[InotifyMonitor].   //!