chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1564: srfi-18: (mutex-unlock) Internal scheduler err


From: Chicken Trac
Subject: [Chicken-janitors] #1564: srfi-18: (mutex-unlock) Internal scheduler error
Date: Fri, 30 Nov 2018 09:26:08 -0000

#1564: srfi-18: (mutex-unlock) Internal scheduler error
-------------------------------+------------------------------
 Reporter:  megane             |                 Owner:
     Type:  defect             |                Status:  new
 Priority:  major              |             Milestone:  5.1
Component:  extensions         |               Version:  5.0.0
 Keywords:  scheduler threads  |  Estimated difficulty:
-------------------------------+------------------------------
 {{{
 (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!         <--
 #
 }}}

--
Ticket URL: <https://bugs.call-cc.org/ticket/1564>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]