Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-10 Thread felix winkelmann
On Sun, Mar 8, 2009 at 12:34 PM, Peter Bex peter@xs4all.nl wrote: On Sun, Mar 08, 2009 at 12:10:39AM +0100, felix winkelmann wrote: Ok, here is what Marc Feeley, the author of SRFI-18 has to say about this: snip Hope that clarifies things. Hope that clarifies things. Yup, thanks

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-10 Thread Jim Ursetto
On Mon, Mar 2, 2009 at 3:48 PM, Peter Bex peter@xs4all.nl wrote: However, it turns out that an exception thrown in a thread simply terminates the thread instead of unwinding the stack.  The same does not happen in the primordial thread: $ csi #;2 (dynamic-wind (lambda () (print BEFORE))

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-10 Thread Peter Bex
On Tue, Mar 10, 2009 at 04:43:00PM -0500, Jim Ursetto wrote: Hi Peter. You might disagree with the rationale, but the behavior is in fact consistent--your example only happens to work at the REPL. Jim, thanks for that explanation. It cleared up a lot! Cheers, Peter -- http://sjamaan.ath.cx

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-10 Thread Tobia Conforto
John Cowan wrote: Tobia Conforto scripsit: I wonder how other compilers do it. For example, I find Java's (and Python's) try/finally syntax quite useful. I've always thought dynamic-wind was Scheme's equivalent construct, but it would appear I was mistaken. Here's the relevant writeup

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-09 Thread felix winkelmann
On Sun, Mar 8, 2009 at 12:34 PM, Peter Bex peter@xs4all.nl wrote: Yup, thanks for asking him.  It still sucks, though ;) We are bound to the SRFI-18 spec, but you are free to invent your own API. cheers, felix ___ Chicken-users mailing list

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-09 Thread Tobia Conforto
Peter Bex wrote: Yup, thanks for asking him. It still sucks, though ;) This is yet another solution, in case you can't (or don't want to) steal the exception handler from the primordial thread. This one may be safer. But then again, I'm probably missing Marc Feeley's point completely,

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-09 Thread Tobia Conforto
felix winkelmann wrote: Ok, here is what Marc Feeley, the author of SRFI-18 has to say about this: when an uncaught exception occurs in a thread the thread is in bad shape and things have gone sufficiently wrong that there is no universally acceptable way to continue execution. Executing

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-09 Thread Tobia Conforto
Peter Bex wrote: Yup, thanks for asking him. It still sucks, though ;) It does. This is one way to solve it: #;1 (use srfi-18) ; loading library srfi-18 ... #;2 (define exception-protect --- (let ((original-exception-handler (current-exception-handler))) --- (lambda (thunk) ---

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-09 Thread John Cowan
Tobia Conforto scripsit: I wonder how other compilers do it. For example, I find Java's (and Python's) try/finally syntax quite useful. I've always thought dynamic-wind was Scheme's equivalent construct, but it would appear I was mistaken. Here's the relevant writeup from Taylor

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-08 Thread Peter Bex
On Sun, Mar 08, 2009 at 12:10:39AM +0100, felix winkelmann wrote: Ok, here is what Marc Feeley, the author of SRFI-18 has to say about this: snip Hope that clarifies things. Hope that clarifies things. Yup, thanks for asking him. It still sucks, though ;) Cheers, Peter --

Re: [Chicken-users] Threads and dynamic-wind still problematic

2009-03-07 Thread felix winkelmann
On Mon, Mar 2, 2009 at 9:48 PM, Peter Bex peter@xs4all.nl wrote: However, it turns out that an exception thrown in a thread simply terminates the thread instead of unwinding the stack. The same does not happen in the primordial thread: Ok, here is what Marc Feeley, the author of SRFI-18

[Chicken-users] Threads and dynamic-wind still problematic

2009-03-02 Thread Peter Bex
Hi, I just got bitten by this problem: http://lists.gnu.org/archive/html/chicken-users/2008-04/msg00023.html I'm increasing and decreasing a mutex value based on how many threads are doing some work. When they stop working, the mutex is decreased and when they start, the mutex is increased. I