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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1483: Inside #if HAVE_INOTIFY
   instance->poll();    }   #endif    int scan_cnt = max_cnt;    int scan_wait = max_wait;    while(1) {    int ret = max_dir_check_interval;    int cnt;    int t = time();    if (sizeof(monitor_queue)) { +  // NB: peek() can apparently in some circumstances throw errors. +  // cf [bug 7644]. The likely cause being that a different +  // thread removed the last element during the call. Make +  // sure not to propagate the error to the caller. +  mixed err = catch {    Monitor m;    while ((m = monitor_queue->peek()) && (m->next_poll <= t)) {    cnt += check_monitor(m);    if (!(--scan_cnt)) {    m = monitor_queue->peek();    break;    }    }    if (m) {    ret = m->next_poll - t;    if (ret <= 0) ret = 1;    } else {    scan_cnt--;    } -  +  }; +  if (err) { +  master()->handle_error(err);    } -  +  }    if (cnt || !scan_wait || !scan_cnt) {    if (ret_stats) {    ret_stats->num_monitors = sizeof(monitors);    ret_stats->scanned_monitors = max_cnt - scan_cnt;    ret_stats->updated_monitors = cnt;    ret_stats->idle_time = max_wait - scan_wait;    }    return ret;    }    if (ret < scan_wait) {