chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Re: on the hardship of upgrading chicken from 4.6.1 to 4


From: F. Wittenberger
Subject: [Chicken-users] Re: on the hardship of upgrading chicken from 4.6.1 to 4.6.3 -- what I forgot
Date: Wed, 17 Nov 2010 22:35:49 +0100

Am Mittwoch, den 17.11.2010, 21:59 +0100 schrieb Jörg F. Wittenberger:
> == Summary ==
> 
> That's hard.
> 
> ;-) WHY ;-)

* A lot of changes are about white space / reformatting or insignificant
things as replacing angle brackets with round ones.  Especially in LISP
languages, where this amounts to large line wise diff's for no
structural reason.

* One simple "bug" is still there:

(define make-mutex
  (lambda id
    (let* ((id (if (pair? id) (car id) (gensym 'mutex)))
           (m (##sys#make-mutex id ##sys#current-thread)) )
      m) ) )

Even though it seems not too hurt too much, it's very bad,
because it keeps a reference to the thread, which created the mutex
within the mutex for no good (enough) reason.  So far the creating
thread does not own the mutex or has any special relation to it I can
seen.

And if everything would always go the most expected way, one would
rarely notice.  But what's going to happen, if one creates threads,
which create mutexes (which they pass elsewhere for further reference)
and then rely on finalizers to clean up the resources they reference?

The programmer knows the thread to be dead and since there's no
reference left, expects the resources to be freed.  The mutex however
keeps an unused reference and hence just that's not the case.

For me: after a while there are no more file descriptors left.

So why not:

(define make-mutex
  (lambda id
    (let* ((id (if (pair? id) (car id) (gensym 'mutex)))
           (m (##sys#make-mutex id #f)) )
      m) ) )

Its even 18 characters shorter.




reply via email to

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