]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/moe/server/src/ref_cnt.h
828f3111d1405c944a4b0c0debde3e8239cf7300
[l4.git] / l4 / pkg / moe / server / src / ref_cnt.h
1 /*
2  * (c) 2008-2009 Technische Universität Dresden
3  * This file is part of TUD:OS and distributed under the terms of the
4  * GNU General Public License 2.
5  * Please see the COPYING-GPL-2 file for details.
6  */
7 #pragma once
8
9 namespace Moe
10 {
11
12 class Ref_cnt_obj
13 {
14 public:
15   void take() { ++_ref_cnt; }
16   unsigned long release() { return --_ref_cnt; }
17
18   unsigned long ref_cnt() const { return _ref_cnt; }
19
20   Ref_cnt_obj() : _ref_cnt(1) {}
21
22 private:
23   unsigned long _ref_cnt;
24 };
25
26 };