Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

make-safe-thread is a wrapper for (make-thread p . name) that catches exceptions in threads.

Parameter Description
p Thread procedure
name Optional: Thread name

Example

Example 1: Example from fifo use in ln_store

(define (fifo:reader! name proc pause)
  (thread-start! (make-safe-thread (lambda ()
    (let loop () 
      (let loop2 ((data (fifo:read name)))
        (if (fx> (length data) 0) (begin
          (apply proc (car data))
          (loop2 (cdr data)))))
      (thread-sleep! pause)
      (loop))))))
Clone this wiki locally