Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] if and loop pointcuts

 --- Gregor Kiczales <gregor@xxxxxxxxx> wrote: > 

>> No, I want to have an aspect that takes a lock at
the 
>> first access to a 
>> variable (this is easy to detect) and releases the
lock after 
>> the last access to 
>> that variable (and here comes my problem).

>Before thinking about this more, I want to ask why
you don't want to do
>the simpler thing of just releasing the lock when the
enclosing method
>terminates? It seems to me that you'll have a lot of
overhead for counting
>gets/sets and figuring out which path you are on.
>While I can see that
>minimizing the locking window is good, I wonder if
>you'll be paying so
>much for it that it won't be worth it.

>I see some other issues, but I wanted to ask this
question first, before
>trying to think about those other issues.


   Actually, I do not want to count gets/sets. I do
not want to detect (by code in an advice) where is the
first access to a variable, either. 
   If I would do the lock take/release by hand in the
application code, I would know (see) exactly where the
first and last access to a variable is. 
   The reason why I need to count accesses and compare
to a given value to detect the last access,
respectively use a boolean variable and simple test to
detect the first access, is that I did not figure out
how to "say" in AspectJ that the "take lock" advice
code should be weaved in before only the first access,
and the "release lock" advice code should be weaved in
after only the last access.
   I know that there is an if(boolean_expr) that can
be used to define pointcuts, but that (as far as I
understood) only allows static variables in its
expression, and that is not good for me. 


        Thank you again,
           Diana.

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/


Back to the top