with-timeout for misilver added by alaricsp on Wed Jul 13 16:52:09 2016

(use srfi-18)

(define (with-timeout seconds thunk default)
  (let ((thread (make-thread thunk)))
    (thread-start! thread)
    (thread-join! thread seconds default)))

;; returns the value of the thunk or, if it takes more than 'seconds' seconds, the default value instead

;; does not kill the thunk thread!