00001 #ifndef SGGUARD_HXX_INCLUDED 00002 #define SGGUARD_HXX_INCLUDED 1 00003 00009 template<class SGLOCK> 00010 class SGGuard 00011 { 00012 public: 00013 00018 inline SGGuard( SGLOCK& l ) : lock(l) { lock.lock(); } 00019 00023 inline ~SGGuard() { lock.unlock(); } 00024 00025 private: 00026 00030 SGLOCK& lock; 00031 00032 private: 00033 // Disable copying. 00034 SGGuard(const SGLOCK&); 00035 SGLOCK& operator= (const SGLOCK&); 00036 }; 00037 00038 #endif // SGGUARD_HXX_INCLUDED