Branch: Tag:

2015-09-18

2015-09-18 10:00:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Filesystem.Monitor: Added check_all().

40: Inside #if HAVE_EVENTSTREAM
   {    monitors[path]->check(0);    } -  else check(0); +  else check_all();    }   #elseif HAVE_INOTIFY   
68:    monitors[path]->check(0);    }    else -  { check(0); // no need to look at the others if we're going to do a full scan. +  { +  // No need to look at the other entries if we're going to do +  // a full scan. +  check_all();    return;    }   
1067:    return m->check(flags);   }    + //! Check all monitors for changes. + //! + //! @param ret_stats + //! Optional mapping that will be filled with statistics (see below). + //! + //! All monitored paths will be checked for changes. + //! + //! @note + //! You typically don't want to call this function, but instead + //! @[check()]. + //! + //! @note + //! Any callbacks will be called from the same thread as the one + //! calling @[check()]. + //! + //! @seealso + //! @[check()], @[monitor()] + void check_all(mapping(string:int)|void ret_stats) + { +  int cnt; +  int scanned_cnt; +  foreach(monitors; string path; Monitor m) { +  scanned_cnt++; +  cnt += check_monitor(m); +  } +  if (ret_stats) { +  ret_stats->num_monitors = sizeof(monitors); +  ret_stats->scanned_monitors = scanned_cnt; +  ret_stats->updated_monitors = cnt; +  ret_stats->idle_time = 0; +  } + } +    //! Check for changes.   //!   //! @param max_wait
1106:   //! calling @[check()].   //!   //! @seealso - //! @[monitor()] + //! @[check_all()], @[monitor()]   int check(int|void max_wait, int|void max_cnt,    mapping(string:int)|void ret_stats)   {