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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1115:   }      //! Backend to use.   //!   //! If @expr{0@} (zero) - use the default backend.   protected Pike.Backend backend;      //! Call-out identifier for @[backend_check()] if in   //! nonblocking mode.   //! + //! Set to @expr{1@} when non_blocking mode without call_outs + //! is in use. + //!   //! @seealso   //! @[set_nonblocking()], @[set_blocking()]   protected mixed co_id;      //! Change backend.   //!   //! @param backend   //! Backend to use. @expr{0@} (zero) for the default backend.   void set_backend(Pike.Backend|void backend)   {
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1156:   //! Backend check callback function.   //!   //! This function is intended to be called from a backend,   //! and performs a @[check()] followed by rescheduling   //! itself via a call to @[set_nonblocking()].   //!   //! @seealso   //! @[check()], @[set_nonblocking()]   protected void backend_check()   { -  co_id = 0; +  if (co_id != 1) co_id = 0;    int t;    mixed err = catch {    t = check(0);    }; - #if HAVE_EVENTSTREAM - // if we are using FSEvents, we don't want to run this check more than once to prime the pumps. - #elseif HAVE_INOTIFY - // if we are using Inotify, we don't want to run this check more than once to prime the pumps. - #else +     set_nonblocking(t); - #endif /* HAVE_EVENTSTREAM */ +     if (err) throw(err);   }      //! Turn on nonblocking mode.   //!   //! @param t   //! Suggested time in seconds until next call of @[check()].   //!   //! Register suitable callbacks with the backend to automatically   //! call @[check()].
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1197:   //! @[set_blocking()], @[check()].   void set_nonblocking(int|void t)   {    if (co_id) return;    if (zero_type(t)) {    Monitor m = monitor_queue->peek();    t = (m && m->next_poll - time(1)) || max_dir_check_interval;    if (t > max_dir_check_interval) t = max_dir_check_interval;    if (t < 0) t = 0;    } - // if (backend) co_id = backend->call_out(backend_check, t); - // else co_id = call_out(backend_check, t); + #if HAVE_EVENTSTREAM +  // If we are using FSEvents, we don't need any call_outs. +  co_id = 1; + #elseif HAVE_INOTIFY +  // If we are using Inotify, we don't need any call_outs. +  co_id = 1; + #else +  if (backend) co_id = backend->call_out(backend_check, t); +  else co_id = call_out(backend_check, t); + #endif /* HAVE_EVENTSTREAM */   }      //! Set the @[default_max_dir_check_interval].   void set_max_dir_check_interval(int max_dir_check_interval)   {    if (max_dir_check_interval > 0) {    this_program::max_dir_check_interval = max_dir_check_interval;    } else {    this_program::max_dir_check_interval = default_max_dir_check_interval;    }