Rename Common::FifoQueue to Common::SPSCQueue

Since all queues are FIFO data structures, the name wasn't informative
as to why you'd use it over a normal queue. I originally thought it had
something to do with the hardware graphics FIFO.

This renames it using the common acronym SPSC, which stands for
single-producer single-consumer, and is most commonly used to talk about
lock-free data structures, both of which this is.
This commit is contained in:
Michael M
2017-08-23 16:45:42 -07:00
parent 4ee85a3e07
commit b58f8d19ab
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" />
@ -237,4 +237,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" />
@ -336,4 +336,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();
}