Opened 10 days ago

#1564 new defect

srfi-18: (mutex-unlock) Internal scheduler error

Reported by: megane Owned by:
Priority: major Milestone: 5.1
Component: extensions Version: 5.0.0
Keywords: scheduler threads Cc:
Estimated difficulty:

Description

(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!         <--
#

Change History (0)

Note: See TracTickets for help on using tickets.