/usr/include/simgear/threads/SGGuard.hxx is in libsimgear-dev 3.4.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #ifndef SGGUARD_HXX_INCLUDED
#define SGGUARD_HXX_INCLUDED 1
/**
* A scoped locking utility.
* An SGGuard object locks its synchronization object during creation and
* automatically unlocks it when it goes out of scope.
*/
template<class SGLOCK>
class SGGuard
{
public:
/**
* Create an SGGuard object and lock the passed lockable object.
* @param l A lockable object.
*/
inline SGGuard( SGLOCK& l ) : lock(l) { lock.lock(); }
/**
* Destroy this object and unlock the lockable object.
*/
inline ~SGGuard() { lock.unlock(); }
private:
SGLOCK& lock; //!< A lockable object
private:
// Disable copying.
SGGuard(const SGLOCK&);
SGLOCK& operator= (const SGLOCK&);
};
#endif // SGGUARD_HXX_INCLUDED
|