drop suncc support from singleton class
This commit is contained in:
parent
9aff3c596b
commit
8b5323f101
1 changed files with 20 additions and 37 deletions
|
@ -84,36 +84,17 @@ public:
|
||||||
static MaxAlign staticMemory;
|
static MaxAlign staticMemory;
|
||||||
return new(&staticMemory) T;
|
return new(&staticMemory) T;
|
||||||
}
|
}
|
||||||
#ifdef __SUNPRO_CC
|
|
||||||
// Sun C++ Compiler doesn't handle `volatile` keyword same as GCC.
|
|
||||||
static void destroy(T* obj)
|
|
||||||
#else
|
|
||||||
static void destroy(volatile T* obj)
|
static void destroy(volatile T* obj)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
obj->~T();
|
obj->~T();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
template <typename U> class CreatePolicy=CreateStatic> class MAPNIK_DECL singleton
|
template <typename U> class CreatePolicy=CreateStatic> class MAPNIK_DECL singleton
|
||||||
{
|
{
|
||||||
#else
|
|
||||||
template <typename T,
|
|
||||||
template <typename U> class CreatePolicy=CreateStatic> class singleton
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __SUNPRO_CC
|
|
||||||
/* Sun's C++ compiler will issue the following errors if CreatePolicy<T> is used:
|
|
||||||
Error: A class template name was expected instead of mapnik::CreatePolicy<mapnik::T>
|
|
||||||
Error: A "friend" declaration must specify a class or function.
|
|
||||||
*/
|
|
||||||
friend class CreatePolicy;
|
|
||||||
#else
|
|
||||||
friend class CreatePolicy<T>;
|
friend class CreatePolicy<T>;
|
||||||
#endif
|
|
||||||
static T* pInstance_;
|
static T* pInstance_;
|
||||||
static bool destroyed_;
|
static bool destroyed_;
|
||||||
singleton(const singleton &rhs);
|
singleton(const singleton &rhs);
|
||||||
|
@ -132,6 +113,7 @@ template <typename T,
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef MAPNIK_THREADSAFE
|
#ifdef MAPNIK_THREADSAFE
|
||||||
static mutex mutex_;
|
static mutex mutex_;
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,6 +145,7 @@ template <typename T,
|
||||||
return *pInstance_;
|
return *pInstance_;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MAPNIK_THREADSAFE
|
#ifdef MAPNIK_THREADSAFE
|
||||||
template <typename T,
|
template <typename T,
|
||||||
template <typename U> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
|
template <typename U> class CreatePolicy> mutex singleton<T,CreatePolicy>::mutex_;
|
||||||
|
|
Loading…
Reference in a new issue