21 lines
744 B
Scheme
21 lines
744 B
Scheme
(define-module (knots)
|
|
#:use-module (ice-9 suspendable-ports)
|
|
#:export (call-with-default-io-waiters
|
|
|
|
wait-when-system-clock-behind))
|
|
|
|
(define (call-with-default-io-waiters thunk)
|
|
(parameterize
|
|
((current-read-waiter (@@ (ice-9 suspendable-ports)
|
|
default-read-waiter))
|
|
(current-write-waiter (@@ (ice-9 suspendable-ports)
|
|
default-write-waiter)))
|
|
(thunk)))
|
|
|
|
(define (wait-when-system-clock-behind)
|
|
(let ((start-of-the-year-2000 946684800))
|
|
(while (< (current-time)
|
|
start-of-the-year-2000)
|
|
(simple-format (current-error-port)
|
|
"warning: system clock potentially behind, waiting\n")
|
|
(sleep 20))))
|