Hi.
I use condition-wait in many acquire recursive-lock. Other thread try
to acquire recusirve-lock's lock at dead locked.
Below code reproduce a problem on Clozure CL.
---
(defvar *condition-variable* (bt:make-condition-variable))
(defvar *recursive-lock* (bt:make-recursive-lock))
(defun worker-job (out)
(bt:with-recursive-lock-held (*recursive-lock*)
(bt:with-recursive-lock-held (*recursive-lock*)
(format out "before condition wait~%")
(force-output out)
(bt:condition-wait *condition-variable* *recursive-lock*)
(format out "after condition wait~%")
(force-output out))))
(defun condition-use-in-recursive-lock ()
(let* ((out *standard-output*)
(worker (bt:make-thread (lambda () (worker-job out)))))
(sleep 1)
(format out "before condition notify~%")
(force-output out)
(bt:with-recursive-lock-held (*recursive-lock*) ; Dead lock point.
(bt:condition-notify *condition-variable*)
(format out "after condition notify~%")
(force-output out))
(bt:join-thread worker)))
(condition-use-in-recurive-lock)
---
conditon-wait is lock release and wait semaphore.
Lock object acquirable many times. but conditon-wait is release lock at once.
I make a patch at here.
https://github.com/rayfill/bordeaux-threads/commit/192124d18a2b2858e6e8aa2c…
Poor english sorry...
--
rayfill(a)gmail.com
Jiro OKAZAKI
On Mon, 2012-03-26 at 13:02 +0900, Kiyoshi Mizumaru wrote:
> I think it's good idea to solve this without defining a new process class.
> But in b03b582, make-lock, with-lock-held and current-thread are used
> prior to be
> defined, and lead to compile error.
>
> Moving the "Thread creation" section solved this and works as expected:
> https://bitbucket.org/kmizumar/bordeaux-threads/changeset/02cc8c9b4ce7
Ok, I committed the move
--
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib
I've forgot to send this to the list.
---------- Forwarded message ----------
From: Kiyoshi Mizumaru <kiyoshi.mizumaru(a)gmail.com>
Date: Mon, Mar 26, 2012 at 1:02 PM
Subject: Re: [Bordeaux-threads-devel] join-thread in allegro
To: Stelian Ionescu <sionescu(a)cddr.org>
I think it's good idea to solve this without defining a new process class.
But in b03b582, make-lock, with-lock-held and current-thread are used
prior to be
defined, and lead to compile error.
Moving the "Thread creation" section solved this and works as expected:
https://bitbucket.org/kmizumar/bordeaux-threads/changeset/02cc8c9b4ce7
Kiyoshi
--
Kiyoshi Mizumaru <kiyoshi.mizumaru(a)gmail.com>
On Mon, Mar 26, 2012 at 8:24 AM, Stelian Ionescu <sionescu(a)cddr.org> wrote:
> On Mon, 2012-03-26 at 00:35 +0900, Kiyoshi Mizumaru wrote:
>> Hi,
>>
>> Even though the api documentation doesn't mention it, I've found that
>> join-thread is expected to have a value of the thread's function in some
>> lisp implementations.
>>
>> (asdf:test-system :sqlite) always fails in concurrent access test since
>> it checks return values of join-thread and join-thread's value is nil in
>> current implementation for Allegro CL. The followings are changes I've made
>> to correct this problem, so please have a look at it.
>>
>> https://bitbucket.org/kmizumar/bordeaux-threads/changeset/5de529f36b92
>> https://bitbucket.org/kmizumar/bordeaux-threads/changeset/549bbcdcf794
>>
>> Thanks in advance and sorry for my poor English, I'm still learning it.
>
> I committed a different implementation that uses a hash-table to store
> the return values, which doesn't require us to create a new process
> class. Please test and is some test fails, send the output
>
> --
> Stelian Ionescu a.k.a. fe[nl]ix
> Quidquid latine dictum sit, altum videtur.
> http://common-lisp.net/project/iolib
>
>
> _______________________________________________
> Bordeaux-threads-devel mailing list
> Bordeaux-threads-devel(a)common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/bordeaux-threads-devel
>
Hi,
Even though the api documentation doesn't mention it, I've found that
join-thread is expected to have a value of the thread's function in some
lisp implementations.
(asdf:test-system :sqlite) always fails in concurrent access test since
it checks return values of join-thread and join-thread's value is nil in
current implementation for Allegro CL. The followings are changes I've made
to correct this problem, so please have a look at it.
https://bitbucket.org/kmizumar/bordeaux-threads/changeset/5de529f36b92https://bitbucket.org/kmizumar/bordeaux-threads/changeset/549bbcdcf794
Thanks in advance and sorry for my poor English, I'm still learning it.
Kiyoshi
--
Kiyoshi Mizumaru <kiyoshi.mizumaru(a)gmail.com>
BTW, another tests issue I forgot to report:
On CMUCL bordeaux-threads test suite traps into some active
deadlock, produces 8 MB of '.' symbols in log, constantly runs GC
and finally dies when heap is exhausted.
Best regards,
- Anton