00001 00030 #ifndef GALOIS_RUNTIME_TERMINATION_H 00031 #define GALOIS_RUNTIME_TERMINATION_H 00032 00033 #include "Galois/Runtime/PerThreadStorage.h" 00034 #include "Galois/Runtime/ll/CacheLineStorage.h" 00035 00036 namespace Galois { 00037 namespace Runtime { 00038 00039 class TerminationDetection { 00040 protected: 00041 LL::CacheLineStorage<volatile bool> globalTerm; 00042 public: 00047 virtual void initializeThread() = 0; 00048 00057 virtual void localTermination(bool workHappened) = 0; 00058 00062 bool globalTermination() const { 00063 return globalTerm.data; 00064 } 00065 }; 00066 00067 //returns an object. The object will be reused. 00068 TerminationDetection& getSystemTermination(); 00069 00070 } // end namespace Runtime 00071 } // end namespace Galois 00072 00073 #endif