chickadee » sqlite3 » make-busy-timeout

make-busy-timeout MSprocedure

Returns a handler suitable for use with set-busy-handler!. It polls in increasing intervals until the timeout in milliseconds is reached. The handler is non-blocking.

(define open-database/timeout
  (let ((handler (make-busy-timeout 2000)))
    (lambda (db-name)
      (let ((db (open-database db-name)))
        (set-busy-handler! db handler)
        db))))