ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
core
thread
inc
TAtomicCountWin32.h
Go to the documentation of this file.
1
// @(#)root/thread:$Id$
2
// Author: Fons Rademakers 14/11/06
3
4
/*************************************************************************
5
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#ifndef ROOT_TAtomicCountWin32
13
#define ROOT_TAtomicCountWin32
14
15
//////////////////////////////////////////////////////////////////////////
16
// //
17
// TAtomicCountWin32 //
18
// //
19
// Class providing atomic operations on a long. Setting, getting, //
20
// incrementing and decrementing are atomic, thread safe, operations. //
21
// //
22
// This implementation uses the Win32 InterLocked API for locking. //
23
// //
24
// ATTENTION: Don't use this file directly, it is included by //
25
// TAtomicCount.h. //
26
// //
27
//////////////////////////////////////////////////////////////////////////
28
29
# include "
Windows4Root.h
"
30
31
class
TAtomicCount
{
32
private
:
33
Long_t
fCnt
;
// counter
34
35
TAtomicCount
(
const
TAtomicCount
&);
// not implemented
36
TAtomicCount
&
operator=
(
const
TAtomicCount
&);
// not implemented
37
38
public
:
39
explicit
TAtomicCount
(
Long_t
v
) :
fCnt
(v) { }
40
void
operator++
() { InterlockedIncrement(&
fCnt
); }
41
Long_t
operator--
() {
return
InterlockedDecrement(&
fCnt
); }
42
operator
long()
const
{
return
static_cast<
long
const
volatile
&
>
(
fCnt
); }
43
void
Set
(
Long_t
v
) {
fCnt
=
v
; }
44
Long_t
Get
()
const
{
return
static_cast<
long
const
volatile
&
>
(
fCnt
); }
45
};
46
47
#endif
TAtomicCount::operator--
Long_t operator--()
Definition:
TAtomicCountWin32.h:41
TAtomicCount
Definition:
TAtomicCount.h:71
Windows4Root.h
v
SVector< double, 2 > v
Definition:
Dict.h:5
TAtomicCount::Set
void Set(Long_t v)
Definition:
TAtomicCountWin32.h:43
TAtomicCount::TAtomicCount
TAtomicCount(Long_t v)
Definition:
TAtomicCountWin32.h:39
Long_t
long Long_t
Definition:
RtypesCore.h:50
TAtomicCount::fCnt
Long_t fCnt
Definition:
TAtomicCount.h:73
TAtomicCount::operator=
TAtomicCount & operator=(const TAtomicCount &)
TAtomicCount::Get
Long_t Get() const
Definition:
TAtomicCountWin32.h:44
TAtomicCount::TAtomicCount
TAtomicCount(const TAtomicCount &)
TAtomicCount::operator++
void operator++()
Definition:
TAtomicCountWin32.h:40