Merge pull request #5973 from ligfx/renamefifoqueue

Rename Common::FifoQueue to Common::SPSCQueue
This commit is contained in:
JosJuice
2017-11-19 13:51:22 +01:00
committed by GitHub
13 changed files with 35 additions and 35 deletions

View File

@ -14,9 +14,9 @@
#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "Common/FifoQueue.h"
#include "Common/Flag.h"
#include "Common/HttpRequest.h"
#include "Common/SPSCQueue.h"
// Utilities for analytics reporting in Dolphin. This reporting is designed to
// provide anonymous data about how well Dolphin performs in the wild. It also
@ -157,7 +157,7 @@ protected:
std::thread m_reporter_thread;
Common::Event m_reporter_event;
Common::Flag m_reporter_stop_request;
FifoQueue<std::string> m_reports_queue;
SPSCQueue<std::string> m_reports_queue;
};
// Analytics backend to be used for debugging purpose, which dumps reports to

View File

@ -62,7 +62,6 @@
<ClInclude Include="DebugInterface.h" />
<ClInclude Include="ENetUtil.h" />
<ClInclude Include="Event.h" />
<ClInclude Include="FifoQueue.h" />
<ClInclude Include="File.h" />
<ClInclude Include="FileSearch.h" />
<ClInclude Include="FileUtil.h" />
@ -142,6 +141,7 @@
<ClInclude Include="SDCardUtil.h" />
<ClInclude Include="Semaphore.h" />
<ClInclude Include="SettingsHandler.h" />
<ClInclude Include="SPSCQueue.h" />
<ClInclude Include="StringUtil.h" />
<ClInclude Include="Swap.h" />
<ClInclude Include="SymbolDB.h" />
@ -238,4 +238,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -41,7 +41,6 @@
<ClInclude Include="CPUDetect.h" />
<ClInclude Include="DebugInterface.h" />
<ClInclude Include="ENetUtil.h" />
<ClInclude Include="FifoQueue.h" />
<ClInclude Include="FileSearch.h" />
<ClInclude Include="FileUtil.h" />
<ClInclude Include="FixedSizeQueue.h" />
@ -62,6 +61,7 @@
<ClInclude Include="ScopeGuard.h" />
<ClInclude Include="SDCardUtil.h" />
<ClInclude Include="SettingsHandler.h" />
<ClInclude Include="SPSCQueue.h" />
<ClInclude Include="StringUtil.h" />
<ClInclude Include="Swap.h" />
<ClInclude Include="SymbolDB.h" />
@ -337,4 +337,4 @@
<ItemGroup>
<Natvis Include="BitField.natvis" />
</ItemGroup>
</Project>
</Project>

View File

@ -5,7 +5,7 @@
#pragma once
// a simple lockless thread-safe,
// single reader, single writer queue
// single producer, single consumer queue
#include <algorithm>
#include <atomic>
@ -16,11 +16,11 @@
namespace Common
{
template <typename T, bool NeedSize = true>
class FifoQueue
class SPSCQueue
{
public:
FifoQueue() : m_size(0) { m_write_ptr = m_read_ptr = new ElementPtr(); }
~FifoQueue()
SPSCQueue() : m_size(0) { m_write_ptr = m_read_ptr = new ElementPtr(); }
~SPSCQueue()
{
// this will empty out the whole queue
delete m_read_ptr;
@ -28,7 +28,7 @@ public:
u32 Size() const
{
static_assert(NeedSize, "using Size() on FifoQueue without NeedSize");
static_assert(NeedSize, "using Size() on SPSCQueue without NeedSize");
return m_size.load();
}