Welcome to the CHICKEN Scheme pasting service

channel-receive with timeout added by mario-goulart on Fri Mar 9 14:42:28 2012

(use srfi-18 channel)

(define channel (make-channel))

(define writer
  (thread-start!
   (lambda ()
     (let ((counter 0))
       (let loop ()
	 (set! counter (+ 1 counter))
	 (channel-enqueue channel counter)
	 (thread-sleep! (random 3))
	 (loop))))))

(thread-start!
 (lambda ()
   (let loop ()
     (print "Got " (channel-receive channel 0))
     (thread-sleep! 1)
     (loop))))

(thread-join! writer)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure returns the number of elements in a list?
Visually impaired? Let me spell it for you (wav file) download WAV