guile-devel
[Top][All Lists]
Advanced

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

Re: deadlock in scm_join_thread(_timed)


From: Neil Jerram
Subject: Re: deadlock in scm_join_thread(_timed)
Date: Wed, 20 May 2009 19:24:57 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

"Julian Graham" <address@hidden> writes:

> Hi Neil,
>
>> Based on the synopsis above, I agree that moving step 1 inside the loop
>> should fix this.  In addition, though, I think it would be very good if we
>> could add a minimal test that currently reproduces the deadlock, and so will
>> serve to guard against future regressions here.  Do you have such a test?
>
> I don't -- it seems to be pretty dependent on timing.  I noticed it
> while running my SRFI-18 test suite in a loop, and it took hours to
> trigger.  Any suggestions?

I'm looking into this now.  Here's a nice little program that
reproduces the deadlock.

(use-modules (ice-9 threads))

(define other-thread
  (make-thread sleep 5))

(letrec ((delay-count 10)
         (aproc (lambda ()
                  (display delay-count) (newline)
                  (set! delay-count (- delay-count 1))
                  (if (zero? delay-count)
                      (begin
                        (display "sleeping...\n")
                        (sleep 10)
                        (display "waking...\n"))
                      (system-async-mark aproc)))))
  (sleep 2)
  (system-async-mark aproc)
  (join-thread other-thread))


Regards,
        Neil




reply via email to

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