Welcome to the CHICKEN Scheme pasting service

srfi-18 error pasted by megane on Fri Nov 30 09:59:13 2018

(import srfi-18)
(import (chicken random))

(define m (make-mutex))
(define (rt) (/ (pseudo-random-integer 100) 1000))
(define (y)
  (let lp4 ()
    (unless (= 0 (pseudo-random-integer 10))
      (print (current-thread) " " "yield")
      (thread-yield!)
      (lp4))))

(thread-start!
 (make-thread (lambda ()
                (let lp ()
                  (print (current-thread) " " "lock")
                  (mutex-lock! m (rt))
                  (print (current-thread) " " "unlock")
                  (mutex-unlock! m)
                  (y)
                  (lp)))))

(let lp2 ()
  (print (current-thread) " " "lock")
  (mutex-lock! m (rt))
  (print (current-thread) " " "sleep")
  (thread-sleep! (rt))
  (print (current-thread) " " "unlock")
  (mutex-unlock! m)
  (lp2))

I get this error added by C-Keen on Fri Nov 30 10:02:33 2018

Warning (#<thread: thread1>): in thread: (mutex-unlock) Internal scheduler error: unknown thread state
#<thread: primordial>
ready

        Call history:

        t.scm:7: chicken.random#pseudo-random-integer
        t.scm:7: scheme#/
        t.scm:19: srfi-18#mutex-lock!
        t.scm:20: srfi-18#current-thread
        t.scm:20: chicken.base#print
        t.scm:21: srfi-18#mutex-unlock!         <--
#

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `define-foreign-type'?
Visually impaired? Let me spell it for you (wav file) download WAV