﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1564	srfi-18: (mutex-unlock) Internal scheduler error	megane		"{{{
(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))

}}}

{{{
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!         <--
#
}}}"	defect	new	major	6.0.0	extensions	5.0.0		scheduler threads		
