Branch: Tag:

2017-06-27

2017-06-27 11:56:02 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Filesystem.Monitor: Reschedule the poll earlier on demand.

Don't wait for the full old poll interval if we know that we need
to check earlier than it expires.

Reduces poll (and notification) delays in some circumstances.

1164:   protected void adjust_monitor(Monitor m)   {    mixed key = monitor_mutex->lock(); +  int old_min = monitor_queue->peek()->next_poll;    monitor_queue->adjust(m); -  +  if ((m->next_poll < old_min) && co_id && (co_id != 1)) { +  // Nonblocking mode and we need to poll earlier, +  // so reschedule the call_out. +  MON_WERR("Rescheduling call_out.\n"); +  if (backend) backend->remove_call_out(co_id); +  else remove_call_out(co_id); +  co_id = 0; +  set_nonblocking();    } -  + }      //! Create a new @[Monitor] for a @[path].   //!