I think you could use a global static variable as a flag. Set one when class B starts to execute, and you can read it from within class A, unset it when class B finishes executing. Here is an example of using such a flag:Suppose you had the following class:
public class p {
public static boolean firstRun = true;
}
A trigger that uses this class could then selectively fail the first run of the trigger:
trigger t1 on Account (before delete, after delete, after undelete) {
if(Trigger.isBefore){
if(Trigger.isDelete){
if(p.firstRun){
Trigger.old[0].addError('Before Account Delete Error');
p.firstRun=false;
}
}
}
}