Skip to content

Commit

Permalink
support for subclass of thread
Browse files Browse the repository at this point in the history
buggy though
  • Loading branch information
kheradmand committed Feb 6, 2015
1 parent 5bc3ec3 commit e77f2c7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/resources/AspectJTemplate.aj
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import java.util.concurrent.locks;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.Condition;


public aspect %NAME% {

Expand All @@ -11,21 +14,21 @@ public aspect %NAME% {
final long[] threadOrder = %THREAD_CREATION_ORDER%;
int threadOrderIndex = 0;

before(): call(java.lang.Thread.new(*)){
before(): call(java.lang.Thread+.new(*)){
threadCreationLock.lock();
while (threadOrderIndex < threadOrder.length &&
threadOrder[threadOrderIndex] != Thread.currentThread().getId()){
try{
threadCreated.await()
threadCreated.await();
}catch (InterruptedException e){

}
}
}

after(): call(java.lang.Thread.new(*)){
threadOrderIndex++
headMatched.signalAll()
after(): call(java.lang.Thread+.new(*)){
threadOrderIndex++;
threadCreated.signalAll();
threadCreationLock.unlock();
}

Expand All @@ -37,7 +40,7 @@ public aspect %NAME% {

//pointcut sharedVarSet(): %SHARED_VAR_SET%

pointcut shareVarAccess(): %SHARED_VAR_ACCESS%;
pointcut sharedVarAccess(): %SHARED_VAR_ACCESS%;
//sharedVarGet() || sharedVarSet()

//==============================shared var end=============================
Expand All @@ -54,7 +57,7 @@ public aspect %NAME% {
enforceSchedule();
}

after(): afterPointcuts() &7 !cflow(adviceexecution()){
after(): afterSync() && !cflow(adviceexecution()){
enforceSchedule();
}

Expand Down

0 comments on commit e77f2c7

Please sign in to comment.