source: NonGTP/Boost/boost/pool/detail/guard.hpp @ 857

Revision 857, 787 bytes checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright (C) 2000 Stephen Cleary
2//
3// Distributed under the Boost Software License, Version 1.0. (See
4// accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org for updates, documentation, and revision history.
8
9#ifndef BOOST_POOL_GUARD_HPP
10#define BOOST_POOL_GUARD_HPP
11
12// Extremely Light-Weight guard glass
13
14namespace boost {
15
16namespace details {
17namespace pool {
18
19template <typename Mutex>
20class guard
21{
22  private:
23    Mutex & mtx;
24
25    guard(const guard &);
26    void operator=(const guard &);
27
28  public:
29    explicit guard(Mutex & nmtx)
30    :mtx(nmtx) { mtx.lock(); }
31
32    ~guard() { mtx.unlock(); }
33};
34
35} // namespace pool
36} // namespace details
37
38} // namespace boost
39
40#endif
Note: See TracBrowser for help on using the repository browser.