[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1356: weak-locatives references return #f when i
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1356: weak-locatives references return #f when it shouldn't |
Date: |
Thu, 23 Mar 2017 20:32:03 -0000 |
#1356: weak-locatives references return #f when it shouldn't
-----------------------------------+--------------------
Reporter: kristianlm | Owner:
Type: defect | Status: new
Priority: major | Milestone: 4.13.0
Component: unknown | Version: 4.12.0
Resolution: | Keywords:
Estimated difficulty: |
-----------------------------------+--------------------
Comment (by kristianlm):
Like sjamaan suggested on #chicken, a finalizer may help to debug things:
{{{
(set-finalizer!
(thread-start!
(lambda ()
(define mutex (make-mutex))
(define cv (make-condition-variable))
(print "locking mutex")
(mutex-lock! mutex)
(let ((REFERENCE (vector 1 2 3)))
(set! wl (make-weak-locative REFERENCE))
(print "unlocking mutex ...")
(mutex-unlock! mutex cv)
(print "unlocked!")
(print "DONE (REFERENCE may now be out of scope) " REFERENCE))))
(lambda (x)
(print "THREAD COLLECTED!")))
}}}
On my machine, the finalizer gets called before REFERENCE is lost.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1356#comment:2>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.