mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Compatibility updates step 1.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@815 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+4
-5
@@ -17,7 +17,6 @@
|
||||
// ----------------------------------------------------------------------------- : AtomicInt : windows
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
extern "C" {
|
||||
LONG __cdecl _InterlockedIncrement(LONG volatile *Addend);
|
||||
@@ -61,16 +60,16 @@
|
||||
typedef unsigned int AtomicIntEquiv;
|
||||
|
||||
/// An integer that can be incremented and decremented atomicly
|
||||
class AtomicIntEquiv {
|
||||
class AtomicInt {
|
||||
public:
|
||||
AtomicIntEquiv(AtomicIntEquiv v) : v(v) {}
|
||||
AtomicInt(AtomicIntEquiv v) : v(v) {}
|
||||
inline operator AtomicIntEquiv() const {
|
||||
return v;
|
||||
}
|
||||
inline AtomicIntEquiv operator ++ () {
|
||||
inline AtomicInt operator ++ () {
|
||||
return __sync_add_and_fetch(&v,1);
|
||||
}
|
||||
inline AtomicIntEquiv operator -- () {
|
||||
inline AtomicInt operator -- () {
|
||||
return __sync_add_and_fetch(&v,(AtomicIntEquiv)-1);
|
||||
}
|
||||
private:
|
||||
|
||||
+10
-7
@@ -149,6 +149,9 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
|
||||
|
||||
// ----------------------------------------------------------------------------- : Intrusive pointer base
|
||||
|
||||
template <typename T> class IntrusivePtrBase;
|
||||
template <typename T> void intrusive_ptr_add_ref(IntrusivePtrBase<T>*);
|
||||
template <typename T> void intrusive_ptr_release(IntrusivePtrBase<T>*);
|
||||
/// Base class for objects wishing to use intrusive_ptrs.
|
||||
/** There is no implicit virtual destructor, objects are destructed as type T
|
||||
* Usage:
|
||||
@@ -171,19 +174,19 @@ inline shared_ptr<T> new_shared9(const A0& a0, const A1& a1, const A2& a2, const
|
||||
}
|
||||
private:
|
||||
AtomicInt ref_count;
|
||||
template <typename T> friend void intrusive_ptr_add_ref(IntrusivePtrBase*);
|
||||
template <typename T> friend void intrusive_ptr_release(IntrusivePtrBase*);
|
||||
friend void intrusive_ptr_add_ref <> (IntrusivePtrBase*);
|
||||
friend void intrusive_ptr_release <> (IntrusivePtrBase*);
|
||||
};
|
||||
|
||||
template <typename T> inline void intrusive_ptr_add_ref(IntrusivePtrBase<T>* p) {
|
||||
++p->ref_count;
|
||||
|
||||
template <typename T> void intrusive_ptr_add_ref(IntrusivePtrBase<T>* p) {
|
||||
++(p->ref_count);
|
||||
}
|
||||
template <typename T> inline void intrusive_ptr_release(IntrusivePtrBase<T>* p) {
|
||||
|
||||
template <typename T> void intrusive_ptr_release(IntrusivePtrBase<T>* p) {
|
||||
if (--p->ref_count == 0) {
|
||||
static_cast<T*>(p)->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Intrusive pointer base : virtual
|
||||
|
||||
/// IntrusivePtrBase with a virtual destructor
|
||||
|
||||
Reference in New Issue
Block a user