[armedbear-devel] [RFC] Support for 'synchronized' blocks in Lisp code
Marco Antoniotti
marcoxa at cs.nyu.edu
Tue Jul 7 14:36:18 UTC 2009
On Jul 7, 2009, at 16:28 , Alessio Stalla wrote:
> On Tue, Jul 7, 2009 at 3:49 PM, Ville
> Voutilainen<ville.voutilainen at gmail.com> wrote:
>> On Tue, Jul 7, 2009 at 4:30 PM, Erik Huelsmann<ehuels at gmail.com>
>> wrote:
>>> I propose that we introduce a WITH-EXCLUSIVE-ACCESS form in the EXT
>>> package, which takes 1 argument (the second value) and a body (the
>>> third value). The form makes sure that the body is evaluated as if
>>> it
>>> had been called with:
>>> synchronized (arg1) {
>>> body-to-evaluate;
>>> }
>>> Except that it implements this in Lisp. This way, our Lisp<>Java
>>> interoperability would increase. It would also be an efficient way
>>> to
>>> guarantee exclusive access when modifying a cross-thread shared
>>> resource (such as generic functions).
>>> Comments?
>>
>> Sounds good, although WITH-EXCLUSIVE-ACCESS isn't very descriptive to
>> me, I'd go for WITH-THREAD-LOCK. (not WITH-LOCK, because there are
>> many
>> kinds of locks). Just my 0.02. ;)
>
> Do you mean so that Lisp code could be synchronized with Java code on
> the same object lock? That would be great. It'll need also a Lisp
> interface to wait(), notify() and company, but this is trivial. About
> the name, why not SYNCHRONIZED or SYNCHRONIZED-ON or
> WITH-SYNCHRONIZED-BLOCK or something like those? It's closer to Java
> terminology that way. But, any of the proposed names are fine by me.
I second that. SYNCHRONIZED-ON or variants look better than the WITH-
variants. Also, please do not make the EXT package a kitchen sink.
Java thought us to (at least) try to separate things in appropriate
namespaces. Choose a special threading-related package name where
these thing should be put.
Cheers
--
Marco Antoniotti
More information about the armedbear-devel
mailing list