[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] SRFI-18 mutexes with timeouts behave differently fro
From: |
Andy Bennett |
Subject: |
Re: [Chicken-users] SRFI-18 mutexes with timeouts behave differently from mutexes without timeouts |
Date: |
Sun, 16 Sep 2012 17:24:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 |
Hi,
> When I added a timeout weird things started happening so I made a
> self-contained test case:
I notice that my code is almost identical to that in the wiki under the
documentation for thread-yield!:
-----
; a busy loop that avoids being too wasteful of the CPU
(let loop ()
(if (mutex-lock! m 0) ; try to lock m but don't block
(begin
(display "locked mutex m")
(mutex-unlock! m))
(begin
(do-something-else)
(thread-yield!) ; relinquish rest of quantum
(loop))))
-----
Trying my self-contained test case above with an additional
thread-yield! in the unsuccessful branch and timeouts of 0 and 1 result
in the same problem of eventually being unable to lock the mutex.
Regards,
@ndy
--
address@hidden
http://www.ashurst.eu.org/
0x7EBA75FF