Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

RaceWindow.java

00001 package gov.nasa.arc.ase.jpf.jvm.runtime;
00002 
00003 import gov.nasa.arc.ase.jpf.*;
00004 import gov.nasa.arc.ase.jpf.jvm.*;
00005 import java.util.*;
00006 import gov.nasa.arc.ase.util.Debug;
00007 
00008 public class RaceWindow{
00009 // ifdef RACE
00010   public static boolean active = false;
00011 
00012   private static eHashSet/*ThreadInfo*/ threads     = new eHashSet();
00013   private static eHashSet/*String*/     threadNames = new eHashSet();
00014 
00015 //#endif RACE
00016   public static void addRace(LockNode masterNode,LockNode slaveNode){
00017     threads.add(masterNode.getThreadInfo());
00018     threads.add(slaveNode.getThreadInfo());
00019   }  
00020   public static void addRace(LockStatus lock_status){
00021     Access access;
00022     AccessList accesses = lock_status.getAccessList();
00023     Iterator accesses_it = accesses.getIterator();
00024     while (accesses_it.hasNext()){
00025       access = (Access)accesses_it.next();
00026       threads.add(access.getThreadInfo());
00027     };
00028   }  
00029   public static boolean contains(String threadName){
00030     return threadNames.contains(threadName);
00031   }  
00032   public static void makeActive(){
00033     threadNames = Depend.createWindow(threads);
00034     if(!threadNames.isEmpty()) active = true;
00035   }  
00036   public static void print(){
00037     ThreadInfo thread;
00038     String threadName;
00039 
00040     Analyze.println("");
00041     if (threadNames.isEmpty()){
00042       Analyze.println("------------------------------------");
00043       Analyze.println("Since no runtime problems were      ");
00044       Analyze.println("encountered, all threads are        ");
00045       Analyze.println("included in subsequent verification.");
00046       Analyze.println("------------------------------------");
00047     }
00048     else{
00049       Analyze.println("------------------------");
00050       Analyze.println("Threads involved in     ");
00051       Analyze.println("runtime conflicts:      ");
00052       Analyze.println("------------------------");
00053       Iterator threads_it = threads.iterator();
00054       while(threads_it.hasNext()){
00055         thread = (ThreadInfo)threads_it.next();
00056         Analyze.println(thread.getClassInfo().getClassName());
00057       };
00058       Analyze.println("------------------------");
00059       Analyze.println("");
00060 
00061       Analyze.println("");
00062       Analyze.println("------------------------");
00063       Analyze.println("Race Window used during ");
00064       Analyze.println("subsequent verification:");
00065       Analyze.println("------------------------");
00066       Iterator threadNames_it = threadNames.iterator();
00067       while(threadNames_it.hasNext()){
00068         threadName = (String)threadNames_it.next();
00069         Analyze.println(threadName);
00070       };
00071       Analyze.println("------------------------");
00072       Analyze.println("");
00073     }
00074   }  
00075 }

Generated at Thu Feb 7 06:53:16 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001