chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] catch exceptions in finalizers, remove dyn


From: Jörg F . Wittenberger
Subject: Re: [Chicken-hackers] [PATCH] catch exceptions in finalizers, remove dynamic resizing of finalizer vector
Date: 19 Jun 2012 21:52:32 +0200

On Jun 19 2012, Peter Bex wrote:

What I don't quite understand is all this talk about threads.  The test
program doesn't even create any extra threads, so how could there be any
race conditions?  There shouldn't *be* any concurrency in this case,
should there?

Isn't this more of a text-book-example of an issue?

By definition a finalizer is a unit of execution to be scheduled
to run when a certain condition is met.  Letting alone discussions
which data structure is called a thread: this requires some,
possibly minimal scheduling.  Hence worry about concurrency.

BTW: there are many more such issues.  E.g. "delay".  The promise
is supposed to be computed just once.  Try:

(use srfi-18)

(define foo (let ((called 0)) (delay (begin (set! called (+ called 1)) (thread-sleep! 10) called))))

(do ((i 0 (+ i 1))) ((= i 5)) (thread-start! (lambda () (force foo))))

(force foo)


To summarize: I subscribe to Felix view that it would be great to
have the core system thread free.  However I'm honestly unsure
that this is at all possible, given that we have threads masquerading
under the name of promises and finalizers, which inherently require
some scheduling.

However I'd welcome to expel the scheduler from the base
system and instead have some simpler API, where I can register
a continuation to wait for events from files, time, signals
other threads and other resources.  The current scheduler
as well as fictionally once based on zmq as suggested by <whom>
on the list the other day should have an easy time to hook
into this API.  ---  Quite a project IMHO.

Best Regards

/Jerry
.........



reply via email to

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