1 #ifndef SGGUARD_HXX_INCLUDED
2 #define SGGUARD_HXX_INCLUDED 1
5 * A scoped locking utility.
6 * An SGGuard object locks its synchronization object during creation and
7 * automatically unlocks it when it goes out of scope.
15 * Create an SGGuard object and lock the passed lockable object.
16 * @param l A lockable object.
18 inline SGGuard( SGLOCK& l ) : lock(l) { lock.lock(); }
21 * Destroy this object and unlock the lockable object.
23 inline ~SGGuard() { lock.unlock(); }
27 SGLOCK& lock; //!< A lockable object
31 SGGuard(const SGLOCK&);
32 SGLOCK& operator= (const SGLOCK&);
35 #endif // SGGUARD_HXX_INCLUDED