diff --git a/src/std/event.ss b/src/std/event.ss index 2af59c6f2..1ee6c32d5 100644 --- a/src/std/event.ss +++ b/src/std/event.ss @@ -140,7 +140,7 @@ (mutex-unlock! mx)))) (def (selector-wait-io-condvar sel timeo) - (##wait-for-io! sel (or timeo #t))) + (##wait-for-io! sel (if timeo (timeout->abs-timeout->seconds timeo) #t))) (def (maybe-timeout? obj) (or (not obj) @@ -151,6 +151,11 @@ (if (time? timeo) timeo (seconds->time (+ (##current-time-point) timeo)))) +(def (timeout->abs-timeout->seconds timeo) + (if (time? timeo) + (time->seconds timeo) + (+ (##current-time-point) timeo))) + (def (io-condition-variable? obj) (and (condition-variable? obj) (##foreign? (macro-condvar-name obj))))