Rename SharedSingleton and move files around

This commit is contained in:
Vinnie Falco
2013-06-30 03:08:15 -07:00
parent ca1eda2df1
commit 3fea8a4202
20 changed files with 121 additions and 76 deletions

View File

@@ -62,13 +62,6 @@ namespace beast
#include "threads/beast_ThreadGroup.cpp"
#include "threads/beast_ThreadWithCallQueue.cpp"
#if BEAST_WINDOWS
#include "native/beast_win32_FPUFlags.cpp"
#else
#include "native/beast_posix_FPUFlags.cpp"
#endif
}
#if BEAST_MSVC

View File

@@ -248,11 +248,9 @@ namespace beast
#include "functor/beast_Function.h"
#include "diagnostic/beast_CatchAny.h"
#include "events/beast_OncePerSecond.h"
#include "math/beast_Interval.h"
#include "math/beast_Math.h"
#include "math/beast_MurmurHash.h"
#include "memory/beast_AllocatedBy.h"
#include "memory/beast_RefCountedSingleton.h"
#include "memory/beast_PagedFreeStore.h"
#include "memory/beast_GlobalPagedFreeStore.h"
#include "memory/beast_FifoFreeStoreWithTLS.h"

View File

@@ -18,12 +18,12 @@
//==============================================================================
class OncePerSecond::TimerSingleton
: public RefCountedSingleton <OncePerSecond::TimerSingleton>
: public SharedSingleton <OncePerSecond::TimerSingleton>
, private InterruptibleThread::EntryPoint
{
private:
TimerSingleton ()
: RefCountedSingleton <OncePerSecond::TimerSingleton> (
: SharedSingleton <OncePerSecond::TimerSingleton> (
SingletonLifetime::persistAfterCreation)
, m_thread ("Once Per Second")
{

View File

@@ -22,7 +22,7 @@
// Original source code links in .cpp file
// This file depends on some Juce declarations and defines
// This file depends on some Beast declarations and defines
namespace Murmur
{

View File

@@ -27,7 +27,7 @@
@ingroup beast_concurrent
*/
template <class Tag>
class GlobalFifoFreeStore : public RefCountedSingleton <GlobalFifoFreeStore <Tag> >
class GlobalFifoFreeStore : public SharedSingleton <GlobalFifoFreeStore <Tag> >
{
public:
inline void* allocate (size_t bytes)
@@ -47,7 +47,7 @@ public:
private:
GlobalFifoFreeStore ()
: RefCountedSingleton <GlobalFifoFreeStore <Tag> >
: SharedSingleton <GlobalFifoFreeStore <Tag> >
(SingletonLifetime::persistAfterCreation)
{
}

View File

@@ -27,7 +27,7 @@ static const size_t globalPageBytes = 8 * 1024;
}
GlobalPagedFreeStore::GlobalPagedFreeStore ()
: RefCountedSingleton <GlobalPagedFreeStore> (SingletonLifetime::persistAfterCreation)
: SharedSingleton <GlobalPagedFreeStore> (SingletonLifetime::persistAfterCreation)
, m_allocator (globalPageBytes)
{
}

View File

@@ -27,7 +27,7 @@
@ingroup beast_concurrent
*/
class BEAST_API GlobalPagedFreeStore
: public RefCountedSingleton <GlobalPagedFreeStore>
: public SharedSingleton <GlobalPagedFreeStore>
, LeakChecked <GlobalPagedFreeStore>
{
private:

View File

@@ -29,13 +29,13 @@
@ingroup beast_concurrent
*/
class BEAST_API GlobalThreadGroup : public ThreadGroup,
public RefCountedSingleton <GlobalThreadGroup>
public SharedSingleton <GlobalThreadGroup>
{
private:
friend class RefCountedSingleton <GlobalThreadGroup>;
friend class SharedSingleton <GlobalThreadGroup>;
GlobalThreadGroup ()
: RefCountedSingleton <GlobalThreadGroup> (
: SharedSingleton <GlobalThreadGroup> (
SingletonLifetime::persistAfterCreation)
{
}

View File

@@ -221,6 +221,12 @@ namespace beast
#include "native/beast_osx_ObjCHelpers.h"
#endif
#if BEAST_WINDOWS
#include "native/beast_win32_FPUFlags.cpp"
#else
#include "native/beast_posix_FPUFlags.cpp"
#endif
#if BEAST_ANDROID
#include "native/beast_android_JNIHelpers.h"
#endif

View File

@@ -209,13 +209,10 @@ namespace beast
#include "threads/beast_SpinDelay.h"
#include "memory/beast_StaticObject.h"
#include "diagnostic/beast_LeakChecked.h"
#include "memory/beast_Memory.h"
#include "memory/beast_ByteOrder.h"
#include "logging/beast_Logger.h"
#include "threads/beast_Thread.h"
#include "diagnostic/beast_Debug.h"
#include "diagnostic/beast_SafeBool.h"
#include "diagnostic/beast_Error.h"
@@ -247,12 +244,12 @@ namespace beast
#include "files/beast_FileSearchPath.h"
#include "files/beast_MemoryMappedFile.h"
#include "files/beast_TemporaryFile.h"
#include "functional/beast_Bind.h"
#include "json/beast_JSON.h"
#include "logging/beast_FileLogger.h"
#include "logging/beast_Logger.h"
#include "maths/beast_BigInteger.h"
#include "maths/beast_Expression.h"
#include "maths/beast_Interval.h"
#include "maths/beast_MathsFunctions.h"
#include "maths/beast_Random.h"
#include "maths/beast_Range.h"
@@ -263,6 +260,9 @@ namespace beast
#include "memory/beast_OptionalScopedPointer.h"
#include "memory/beast_ReferenceCountedObject.h"
#include "memory/beast_ScopedPointer.h"
#include "threads/beast_SpinLock.h"
#include "time/beast_PerformedAtExit.h"
#include "memory/beast_SharedSingleton.h"
#include "memory/beast_Singleton.h"
#include "memory/beast_WeakReference.h"
#include "memory/beast_MemoryAlignment.h"
@@ -283,6 +283,7 @@ namespace beast
#include "streams/beast_MemoryOutputStream.h"
#include "streams/beast_OutputStream.h"
#include "streams/beast_SubregionStream.h"
#include "system/beast_Functional.h"
#include "system/beast_PlatformDefs.h"
#include "system/beast_StandardHeader.h"
#include "system/beast_SystemStats.h"
@@ -310,13 +311,11 @@ namespace beast
#include "threads/beast_ScopedLock.h"
#include "threads/beast_ScopedReadLock.h"
#include "threads/beast_ScopedWriteLock.h"
#include "threads/beast_SpinLock.h"
#include "threads/beast_ThreadLocalValue.h"
#include "threads/beast_ThreadPool.h"
#include "threads/beast_TimeSliceThread.h"
#include "threads/beast_WaitableEvent.h"
#include "time/beast_PerformanceCounter.h"
#include "time/beast_PerformedAtExit.h"
#include "time/beast_RelativeTime.h"
#include "time/beast_Time.h"
#include "unit_tests/beast_UnitTest.h"

View File

@@ -17,7 +17,7 @@
*/
//==============================================================================
void FPUFlags::clearUnsetFlagsFrom (const FPUFlags& flags)
void FPUFlags::clearUnsetFlagsFrom (FPUFlags const& flags)
{
if (!flags.getMaskNaNs ().is_set ()) m_maskNaNs.clear ();

View File

@@ -28,7 +28,7 @@
class Object must provide the function `Object* Object::createInstance()`
@class RefCountedSingleton
@class SharedSingleton
@ingroup beast_core
*/
/** @{ */
@@ -42,7 +42,7 @@ public:
// - ville
//
/** Construction options for RefCountedSingleton
/** Construction options for SharedSingleton
@ingroup beast_core
*/
@@ -66,7 +66,7 @@ public:
//------------------------------------------------------------------------------
template <class Object>
class RefCountedSingleton
class SharedSingleton
: public SingletonLifetime
, private PerformedAtExit
{
@@ -77,7 +77,7 @@ protected:
@param lifetime The lifetime management option.
*/
explicit RefCountedSingleton (Lifetime const lifetime)
explicit SharedSingleton (Lifetime const lifetime)
: m_lifetime (lifetime)
{
bassert (s_instance == nullptr);
@@ -94,7 +94,7 @@ protected:
*s_created = true;
}
virtual ~RefCountedSingleton ()
virtual ~SharedSingleton ()
{
bassert (s_instance == nullptr);
}
@@ -181,20 +181,20 @@ private:
private:
static Object* s_instance;
static Static::Storage <LockType, RefCountedSingleton <Object> > s_mutex;
static Static::Storage <bool, RefCountedSingleton <Object> > s_created;
static Static::Storage <LockType, SharedSingleton <Object> > s_mutex;
static Static::Storage <bool, SharedSingleton <Object> > s_created;
};
/** @{ */
template <class Object>
Object* RefCountedSingleton <Object>::s_instance;
Object* SharedSingleton <Object>::s_instance;
template <class Object>
Static::Storage <typename RefCountedSingleton <Object>::LockType, RefCountedSingleton <Object> >
RefCountedSingleton <Object>::s_mutex;
Static::Storage <typename SharedSingleton <Object>::LockType, SharedSingleton <Object> >
SharedSingleton <Object>::s_mutex;
template <class Object>
Static::Storage <bool, RefCountedSingleton <Object> >
RefCountedSingleton <Object>::s_created;
Static::Storage <bool, SharedSingleton <Object> >
SharedSingleton <Object>::s_created;
#endif

View File

@@ -65,7 +65,6 @@ bool Process::openEmailWithAttachments (const String& /* targetEmailAddress */,
class WebInputStream
: public InputStream
, LeakChecked <WebInputStream>
, Uncopyable
{
public:
WebInputStream (const String& address_, bool isPost_, const MemoryBlock& postData_,

View File

@@ -324,7 +324,7 @@ using boost::placeholders::_20;
#else
#error Unknown bind source in beast_Bind.h
#error Unknown bind source in beast_Functional.h
#endif