diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/stable/synchrocounter.h | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/synchrocounter.h')
-rw-r--r-- | src/stable/synchrocounter.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/stable/synchrocounter.h b/src/stable/synchrocounter.h index ef86445..17de890 100644 --- a/src/stable/synchrocounter.h +++ b/src/stable/synchrocounter.h | |||
@@ -12,38 +12,38 @@ | |||
12 | 12 | ||
13 | namespace Bu | 13 | namespace Bu |
14 | { | 14 | { |
15 | /** | 15 | /** |
16 | * A simple thread-safe counter class. This is handy for assigning unique | 16 | * A simple thread-safe counter class. This is handy for assigning unique |
17 | * IDs to objects that are being created in different threads. | 17 | * IDs to objects that are being created in different threads. |
18 | *@ingroup Threading Containers | 18 | *@ingroup Threading Containers |
19 | */ | 19 | */ |
20 | template <class T> | 20 | template <class T> |
21 | class SynchroCounter | 21 | class SynchroCounter |
22 | { | 22 | { |
23 | public: | 23 | public: |
24 | SynchroCounter() : | 24 | SynchroCounter() : |
25 | tCounter( 0 ) | 25 | tCounter( 0 ) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | virtual ~SynchroCounter() | 29 | virtual ~SynchroCounter() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | T next() | 33 | T next() |
34 | { | 34 | { |
35 | mOperate.lock(); | 35 | mOperate.lock(); |
36 | T tRet = tCounter; | 36 | T tRet = tCounter; |
37 | tCounter++; | 37 | tCounter++; |
38 | mOperate.unlock(); | 38 | mOperate.unlock(); |
39 | 39 | ||
40 | return tRet; | 40 | return tRet; |
41 | } | 41 | } |
42 | 42 | ||
43 | private: | 43 | private: |
44 | T tCounter; /**< The counter itself. */ | 44 | T tCounter; /**< The counter itself. */ |
45 | Mutex mOperate; /**< The master mutex, used on all operations. */ | 45 | Mutex mOperate; /**< The master mutex, used on all operations. */ |
46 | }; | 46 | }; |
47 | } | 47 | } |
48 | 48 | ||
49 | #endif | 49 | #endif |