Skip to content

Commit b305e67

Browse files
committed
Oops, fix instancetracker. Sync LLAtomic, since it's so close already.
1 parent ce1fae5 commit b305e67

3 files changed

Lines changed: 6 additions & 54 deletions

File tree

indra/llcommon/llatomic.h

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,17 @@
2727

2828
#pragma once
2929

30+
#include "stdtypes.h"
3031
#define LL_BOOST_ATOMICS 1
3132

32-
//Internal definitions
33-
#define NEEDS_APR_ATOMICS do_not_define_manually_thanks
34-
#undef NEEDS_APR_ATOMICS
35-
36-
//Prefer boost over stl over apr.
37-
3833
#if LL_BOOST_ATOMICS
39-
#include <boost/version.hpp>
4034
#include <boost/atomic.hpp>
4135
template<typename Type>
42-
struct impl_atomic_type { typedef boost::atomic<Type> type; };
36+
using LLAtomic32 = boost::atomic<Type>;
4337
#elif LL_STD_ATOMICS
4438
#include <atomic>
4539
template<typename Type>
46-
struct impl_atomic_type { typedef std::atomic<Type> type; };
47-
#else
48-
#include "apr_atomic.h"
49-
#define NEEDS_APR_ATOMICS
50-
template <typename Type> class LLAtomic32
51-
{
52-
public:
53-
LLAtomic32(void) { }
54-
LLAtomic32(LLAtomic32 const& atom) { apr_uint32_t data = apr_atomic_read32(const_cast<apr_uint32_t*>(&atom.mData)); apr_atomic_set32(&mData, data); }
55-
LLAtomic32(Type x) { apr_atomic_set32(&mData, static_cast<apr_uint32_t>(x)); }
56-
LLAtomic32& operator=(LLAtomic32 const& atom) { apr_uint32_t data = apr_atomic_read32(const_cast<apr_uint32_t*>(&atom.mData)); apr_atomic_set32(&mData, data); return *this; }
57-
58-
operator Type() const { apr_uint32_t data = apr_atomic_read32(const_cast<apr_uint32_t*>(&mData)); return static_cast<Type>(data); }
59-
void operator=(Type x) { apr_atomic_set32(&mData, static_cast<apr_uint32_t>(x)); }
60-
void operator-=(Type x) { apr_atomic_sub32(&mData, static_cast<apr_uint32_t>(x)); }
61-
void operator+=(Type x) { apr_atomic_add32(&mData, static_cast<apr_uint32_t>(x)); }
62-
Type operator++(int) { return apr_atomic_inc32(&mData); } // Type++
63-
Type operator++() { return apr_atomic_inc32(&mData); } // ++Type
64-
Type operator--(int) { return apr_atomic_dec32(&mData); } // Type--
65-
Type operator--() { return apr_atomic_dec32(&mData); } // --Type
66-
67-
private:
68-
apr_uint32_t mData;
69-
};
70-
#endif
71-
#if !defined(NEEDS_APR_ATOMICS)
72-
template <typename Type> class LLAtomic32
73-
{
74-
public:
75-
LLAtomic32(void) { }
76-
LLAtomic32(LLAtomic32 const& atom) { mData = Type(atom.mData); }
77-
LLAtomic32(Type x) { mData = x; }
78-
LLAtomic32& operator=(LLAtomic32 const& atom) { mData = Type(atom.mData); return *this; }
79-
80-
operator Type() const { return mData; }
81-
void operator=(Type x) { mData = x; }
82-
void operator-=(Type x) { mData -= x; }
83-
void operator+=(Type x) { mData += x; }
84-
Type operator++(int) { return mData++; } // Type++
85-
Type operator++() { return ++mData; } // ++Type
86-
Type operator--(int) { return mData--; } // Type--
87-
Type operator--() { return --mData; } // --Type
88-
89-
private:
90-
typename impl_atomic_type<Type>::type mData;
91-
};
40+
using LLAtomic32 = std::atomic<Type>;
9241
#endif
9342

9443
typedef LLAtomic32<U32> LLAtomicU32;

indra/llcommon/llinstancetracker.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "linden_common.h"
2828
// associated header
2929
#include "llinstancetracker.h"
30+
#include "llapr.h"
31+
3032
// STL headers
3133
// std headers
3234
// external library headers

indra/llcommon/llinstancetracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase
7979
{
8080
typedef LLInstanceTracker<T, KEY> self_t;
8181
typedef typename std::multimap<KEY, T*> InstanceMap;
82+
typedef typename InstanceMap::iterator::difference_type difference_type;
8283
struct StaticData: public StaticBase
8384
{
8485
InstanceMap sMap;

0 commit comments

Comments
 (0)