# Method Filesystem.Monitor.basic()->check()

Method check

  ``int` check(`int`|`void` `max_wait`, `int`|`void` `max_cnt`, `mapping`(`string`:`int`)|`void` `ret_stats`)`

Description

  Check for changes.

Parameter `max_wait`

  Maximum time in seconds to wait for changes. `-1` for infinite wait.

Parameter `max_cnt`

  Maximum number of paths to check in this call. `0` (zero) for unlimited.

Parameter `ret_stats`

  Optional mapping that will be filled with statistics (see below).

  A suitable subset of the monitored files will be checked for changes.

Returns

  The function returns when either a change has been detected or when `max_wait` has expired. The returned value indicates the number of seconds until the next call of check().

  If `ret_stats` has been provided, it will be filled with the following entries:

  ``"num_monitors"` : `int`` | The total number of active monitors when the scan completed.
  ``"scanned_monitors"` : `int`` | The number of monitors that were scanned for updates during the call.
  ``"updated_monitors"` : `int`` | The number of monitors that were updated during the call.
  ``"idle_time"` : `int`` | The number of seconds that the call slept.

Note

  Any callbacks will be called from the same thread as the one calling check().

See also

  check_all(), monitor()