sl@0: // Copyright (C) 2000 Stephen Cleary sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: // See http://www.boost.org for updates, documentation, and revision history. sl@0: sl@0: #ifndef BOOST_POOL_GUARD_HPP sl@0: #define BOOST_POOL_GUARD_HPP sl@0: sl@0: // Extremely Light-Weight guard glass sl@0: sl@0: namespace boost { sl@0: sl@0: namespace details { sl@0: namespace pool { sl@0: sl@0: template sl@0: class guard sl@0: { sl@0: private: sl@0: Mutex & mtx; sl@0: sl@0: guard(const guard &); sl@0: void operator=(const guard &); sl@0: sl@0: public: sl@0: explicit guard(Mutex & nmtx) sl@0: :mtx(nmtx) { mtx.lock(); } sl@0: sl@0: ~guard() { mtx.unlock(); } sl@0: }; sl@0: sl@0: } // namespace pool sl@0: } // namespace details sl@0: sl@0: } // namespace boost sl@0: sl@0: #endif