port-idle-reset!

[procedure] port-idle-register! port thunk

[procedure] port-idle-unregister! port thunk

[procedure] port-idle-reset! port

STklos: port idle handler (thunk) is called continuously when a reading primitive is waiting on port.

(let ((idle (lambda () (display "Nothing to read!\n"))))
  (port-idle-register! (current-input-port) idle)
  (let ((result (read)))
    (port-idle-unregister! (current-input-port) idle)
    result))