From: Jörg "F. Wittenberger" <[email protected]> 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. Yes, that's bad. Sorry, I can't stand angle brackets anymore. > > * 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. > Thanks, Joerg. I have changed this accordingly. cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
