Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] A question about cflow across threads

It is a good question and an outstanding issue.

At one point Gregor wrote an email about using a trampoline to extend 
cflow across threads, but I can't find it at present.  It would be nice
to find that, and/or to implement something with InheritableThreadLocal.

However, since cflow is defined to be false after the original join
point returns, there's a weird effect that the spawned thread would
start in the cflow but could all of a sudden not be in the cflow.  
While one might want to define the semantics for cross-thread control 
flows in a new PCD "threadflow({pointcut})" to adopt the topmost entry 
point in the thread as the cflow top, it would result in a similar weird
effect that the context available from the original top join point might 
not correlate to the top or to any running join point.  It's a race whether
"lower" join points could affect the "top" one before it completes.
This could be a great way to write memory leaks.

I'd like to know if users who need this have deployed 
InheritableThreadLocal flags tested in if(..) clauses.  That might 
tell us how many people really need this and what they use it for.  

Wes

> ------------Original Message------------
> From: Pengcheng Wu <wupc@xxxxxxxxxxx>
> To: "AJDT USER" <aspectj-users@xxxxxxxxxxx>
> Date: Wed, Mar-9-2005 11:46 AM
> Subject: Re: [aspectj-users] A question about cflow across threads
>
> Please just ignore this question now. I think it does make sense the
> program behaves like that.
> 
> --Pengcheng
> 
> On Wed, 9 Mar 2005, Pengcheng Wu wrote:
> 
> > Dear all,
> >
> > I have a question about cflow pointcut across threads. Assume I have 
> a
> > program like this:
> >
> >  class A {
> >    public static void main(String[] args) {
> >      A a = new A();
> >      a.foo();
> >    }
> >    public void foo() {
> >      Thread t = new MyThread(this);
> >      t.start();
> >    }
> >    public void bar() { test();}
> >    public void test() {}
> >  }
> >
> >  class MyThread extends Thread {
> >    A a;
> >    public MyThread(A a) {this.a = a;}
> >    public void run() {
> >      a.bar();
> >    }
> >  }
> >
> > The only thing interesting here is that a thread is started in the 
> body of
> > method foo().
> >
> > If I have an aspect, say:
> >
> >  aspect B {
> >   pointcut p(): call(* *.bar()) && cflow(call(* *.foo()));
> >  }
> >
> > Will p() capture the call to bar() during the execution? If it were 
> single
> > thread program, it will capture; but as a multi-thread program as 
> shown
> > above, it doesn't. I am trying to figure out why it is so or it is 
> just a
> > bug.
> >
> > Thanks a lot!
> >
> >  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >   Pengcheng Wu,  PhD Student
> >   College of Computer and Information Science
> >   Northeastern University
> >   Boston, MA 02115, USA
> >
> >
> >
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



Back to the top