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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:707:    }    return 0;    }       protected void destroy()    {    unregister_path(1);    }   }    + //! @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]. + //! + //! @seealso + //! @[monitor_factory()] +  + // NB: See further below for the actual definitions. +  + //! @decl inherit Monitor +  + //! @endclass +    //   // Some necessary setup activities for systems that provide   // filesystem event monitoring   //   #if constant(System.FSEvents.EventStream)   #define HAVE_EVENTSTREAM 1   #endif      #if constant(System.Inotify)   #define HAVE_INOTIFY 1
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:793: Inside #if HAVE_EVENTSTREAM
   file = canonic_path(Stdio.append_path(path, file));    if (monitors[file]) {    if(check_monitor(monitors[file])) ret = 1;    }    }    }    return ret;    }   }    + constant DefaultMonitor = EventStreamMonitor; +    #elseif HAVE_INOTIFY      protected System.Inotify._Instance instance;   protected Stdio.File file;      //! Read callback for events on the Inotify file.   protected void inotify_parse(mixed id, string data)   {    MON_WERR("inotify_parse(%O, %O)...\n", id, data);    while (sizeof(data)) {
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:939:    wd = -1;    if (!dying) {    // We now need to be polled...    MON_WERR("Registering for polling.\n");    monitor_queue->push(this);    }    }    ::unregister_path(dying);    }   } +  + constant DefaultMonitor = InotifyMonitor; +  + #else +  + constant DefaultMonitor = Monitor; +    #endif /* HAVE_EVENTSTREAM || HAVE_INOTIFY */      //! Canonicalize a path.   //!   //! @param path   //! Path to canonicalize.   //!   //! @returns   //! The default implementation returns @expr{combine_path(path, ".")@},   //! i.e. no trailing slashes.
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1049:   {    if (m->accellerated) return;    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()] (or one of - //! @[EventStreamMonitor] or @[InotifyMonitor]) with the same - //! arguments. + //! The default implementation just calls @[DefaultMonitor] with the + //! same arguments.   //!   //! @seealso - //! @[monitor()] - protected Monitor monitor_factory(string path, MonitorFlags|void flags, + //! @[monitor()], @[DefaultMonitor] + protected DefaultMonitor monitor_factory(string path, MonitorFlags|void flags,    int(0..)|void max_dir_check_interval,    int(0..)|void file_interval_factor,    int(0..)|void stable_time)   { - #if HAVE_EVENTSTREAM -  return EventStreamMonitor(path, flags, max_dir_check_interval, +  return DefaultMonitor(path, flags, max_dir_check_interval,    file_interval_factor, stable_time); - #elseif HAVE_INOTIFY -  return InotifyMonitor(path, flags, max_dir_check_interval, -  file_interval_factor, stable_time); - #else /* !HAVE_EVENTSTREAM && !HAVE_INOTIFY */ -  return Monitor(path, flags, max_dir_check_interval, -  file_interval_factor, stable_time); - #endif /* HAVE_EVENTSTREAM || HAVE_INOTIFY */ +    }         //! Register a @[path] for monitoring.   //!   //! @param path   //! Path to monitor.   //!   //! @param flags   //! @int