diff options
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r-- | lib/Handle.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index efe2e15..81c72e7 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -56,6 +56,7 @@ inline Uint32 bswap_32(Uint32 w) { #endif #include "Handle.h" +#include "Atomic.h" #include "gettext.h" enum { @@ -73,7 +74,7 @@ Handle::Handle(const Handle & nh) : itell(0), hFile(0), h(nh.h >= 0 ? nh.ndup() if ((h >= 0) && (nh.z)) { SetZ(nh.z); } - nb_handles++; + Atomic::Increment(&nb_handles); } Handle::~Handle() { @@ -81,7 +82,7 @@ Handle::~Handle() { printm(M_INFO, String(_("Destroying handle ")) + h + "\n"); #endif close(); - nb_handles--; + Atomic::Decrement(&nb_handles); } Handle::Handle(int nh) : itell(0), h(nh), closed(false), nonblock(false), zfile(0), z(0), hMapObject(0), mapped(0) @@ -89,7 +90,7 @@ Handle::Handle(int nh) : itell(0), h(nh), closed(false), nonblock(false), zfile( #ifdef DEBUG printm(M_INFO, String(_("Initialising handle ")) + h + "\n"); #endif - nb_handles++; + Atomic::Increment(&nb_handles); } int Handle::GetHandle() { |