source: proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/guard.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 307 bytes
Line 
1// -*- C++ -*-
2
3#ifndef _GUARD_H_
4#define _GUARD_H_
5
6namespace HL {
7
8  template <class LockType>
9  class Guard {
10  public:
11    inline Guard (LockType& l)
12      : _lock (l)
13      {
14        _lock.lock();
15      }
16
17    inline ~Guard (void) {
18      _lock.unlock();
19    }
20  private:
21    LockType& _lock;
22  };
23
24}
25
26#endif
Note: See TracBrowser for help on using the repository browser.