mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove unused ConcurrentObject
This commit is contained in:
@@ -283,7 +283,6 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_core\threads\beast_TimeSliceThread.h" />
|
<ClInclude Include="..\..\modules\beast_core\threads\beast_TimeSliceThread.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_core\threads\beast_WaitableEvent.h" />
|
<ClInclude Include="..\..\modules\beast_core\threads\beast_WaitableEvent.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_CallQueue.h" />
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_CallQueue.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_ConcurrentObject.h" />
|
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.h" />
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.h" />
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_Listeners.h" />
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_Listeners.h" />
|
||||||
@@ -1079,12 +1078,6 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_ConcurrentObject.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.cpp">
|
<ClCompile Include="..\..\modules\beast_core\thread\beast_DeadlineTimer.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -701,9 +701,6 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_CallQueue.h">
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_CallQueue.h">
|
||||||
<Filter>beast_core\thread</Filter>
|
<Filter>beast_core\thread</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_ConcurrentObject.h">
|
|
||||||
<Filter>beast_core\thread</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.h">
|
<ClInclude Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.h">
|
||||||
<Filter>beast_core\thread</Filter>
|
<Filter>beast_core\thread</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1384,9 +1381,6 @@
|
|||||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_CallQueue.cpp">
|
<ClCompile Include="..\..\modules\beast_core\thread\beast_CallQueue.cpp">
|
||||||
<Filter>beast_core\thread</Filter>
|
<Filter>beast_core\thread</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_ConcurrentObject.cpp">
|
|
||||||
<Filter>beast_core\thread</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.cpp">
|
<ClCompile Include="..\..\modules\beast_core\thread\beast_InterruptibleThread.cpp">
|
||||||
<Filter>beast_core\thread</Filter>
|
<Filter>beast_core\thread</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
class ConcurrentObject::Deleter : private ThreadWithCallQueue::EntryPoints
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
Deleter () : m_thread ("AsyncDeleter")
|
|
||||||
{
|
|
||||||
m_thread.start (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
~Deleter ()
|
|
||||||
{
|
|
||||||
m_thread.stop (true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onExit ()
|
|
||||||
{
|
|
||||||
//delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void doDelete (ConcurrentObject* sharedObject)
|
|
||||||
{
|
|
||||||
delete sharedObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
void destroy (ConcurrentObject* sharedObject)
|
|
||||||
{
|
|
||||||
if (m_thread.isAssociatedWithCurrentThread ())
|
|
||||||
delete sharedObject;
|
|
||||||
else
|
|
||||||
m_thread.call (&Deleter::doDelete, sharedObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Deleter& getInstance ()
|
|
||||||
{
|
|
||||||
static Deleter instance;
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
ThreadWithCallQueue m_thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ConcurrentObject::ConcurrentObject ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ConcurrentObject::~ConcurrentObject ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConcurrentObject::destroyConcurrentObject ()
|
|
||||||
{
|
|
||||||
Deleter::getInstance ().destroy (this);
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_CONCURRENTOBJECT_H_INCLUDED
|
|
||||||
#define BEAST_CONCURRENTOBJECT_H_INCLUDED
|
|
||||||
|
|
||||||
/*============================================================================*/
|
|
||||||
/**
|
|
||||||
A reference counted object with overridable destroy behavior.
|
|
||||||
|
|
||||||
This is a reference counted object compatible with
|
|
||||||
ReferenceCountedObjectPtr. When the last reference is removed, the
|
|
||||||
object is queued for deletion on a separate, provided thread. On
|
|
||||||
program exit the thread will clean itself up - no other action is
|
|
||||||
required.
|
|
||||||
|
|
||||||
This class is useful for offloading the deletion work of "deep" objects
|
|
||||||
shared by multiple threads: objects containing complex members, or a
|
|
||||||
hierarchy of allocated structures. For example, a ValueTree. The problem
|
|
||||||
of performing heavyweight memory or cleanup operations from either an
|
|
||||||
AudioIODeviceCallback or the message thread is avoided.
|
|
||||||
|
|
||||||
The deletion behavior can be overriden by providing a replacement
|
|
||||||
for destroyConcurrentObject().
|
|
||||||
|
|
||||||
@ingroup beast_concurrent
|
|
||||||
*/
|
|
||||||
class BEAST_API ConcurrentObject : Uncopyable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
inline void incReferenceCount () noexcept
|
|
||||||
{
|
|
||||||
m_refs.addref ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void decReferenceCount () noexcept
|
|
||||||
{
|
|
||||||
if (m_refs.release ())
|
|
||||||
destroyConcurrentObject ();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ConcurrentObject ();
|
|
||||||
|
|
||||||
virtual ~ConcurrentObject ();
|
|
||||||
|
|
||||||
/** Delete the object.
|
|
||||||
|
|
||||||
This function is called when the reference count drops to zero. The
|
|
||||||
default implementation performs the delete on a separate, provided thread
|
|
||||||
that cleans up after itself on exit.
|
|
||||||
*/
|
|
||||||
virtual void destroyConcurrentObject ();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
class Deleter;
|
|
||||||
|
|
||||||
private:
|
|
||||||
AtomicCounter m_refs;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user