From d489bcc2cba7c454874ae09e2e1df5d9dc6958aa Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 18 Dec 2013 18:10:39 -0800 Subject: Removing Atomic.h and all volatiles. --- includes/Handle.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'includes/Handle.h') diff --git a/includes/Handle.h b/includes/Handle.h index 1753cb6..15415a6 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include #include #include -#include namespace Balau { @@ -84,13 +84,13 @@ class Handle { ssize_t forceWrite(const void * buf, size_t count, Events::BaseEvent * evt = NULL) throw (GeneralException) __attribute__((warn_unused_result)); protected: - Handle() { } + Handle() : m_refCount(0) { } private: // the IO<> refcounting mechanism - void addRef() { Atomic::Increment(&m_refCount); } + void addRef() { ++m_refCount; } void delRef() { - if (Atomic::Decrement(&m_refCount) == 0) { + if (--m_refCount == 0) { if (!isClosed()) close(); delete this; @@ -100,7 +100,7 @@ class Handle { template friend class IO; - volatile int m_refCount = 0; + std::atomic m_refCount; Handle(const Handle &) = delete; Handle & operator=(const Handle &) = delete; -- cgit v1.2.3