Skip to main content

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

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






Back to the top