Merge pull request #5973 from ligfx/renamefifoqueue
Rename Common::FifoQueue to Common::SPSCQueue
This commit is contained in:
commit
b8c83dd5f3
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
|
||||
|
@ -63,7 +63,7 @@ static std::unordered_map<std::string, EventType> s_event_types;
|
|||
static std::vector<Event> s_event_queue;
|
||||
static u64 s_event_fifo_id;
|
||||
static std::mutex s_ts_write_lock;
|
||||
static Common::FifoQueue<Event, false> s_ts_queue;
|
||||
static Common::SPSCQueue<Event, false> s_ts_queue;
|
||||
|
||||
static float s_last_OC_factor;
|
||||
static constexpr int MAX_SLICE_LENGTH = 20000;
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/Flag.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "Common/Timer.h"
|
||||
|
||||
|
@ -83,8 +83,8 @@ static Common::Event s_request_queue_expanded; // Is set by CPU thread
|
|||
static Common::Event s_result_queue_expanded; // Is set by DVD thread
|
||||
static Common::Flag s_dvd_thread_exiting(false); // Is set by CPU thread
|
||||
|
||||
static Common::FifoQueue<ReadRequest, false> s_request_queue;
|
||||
static Common::FifoQueue<ReadResult, false> s_result_queue;
|
||||
static Common::SPSCQueue<ReadRequest, false> s_request_queue;
|
||||
static Common::SPSCQueue<ReadResult, false> s_result_queue;
|
||||
static std::map<u64, ReadResult> s_result_map;
|
||||
|
||||
static std::unique_ptr<DiscIO::Volume> s_disc;
|
||||
|
@ -139,7 +139,7 @@ void DoState(PointerWrap& p)
|
|||
WaitUntilIdle();
|
||||
|
||||
// Move all results from s_result_queue to s_result_map because
|
||||
// PointerWrap::Do supports std::map but not Common::FifoQueue.
|
||||
// PointerWrap::Do supports std::map but not Common::SPSCQueue.
|
||||
// This won't affect the behavior of FinishRead.
|
||||
ReadResult result;
|
||||
while (s_result_queue.Pop(result))
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/Flag.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
|
||||
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
|
||||
|
@ -112,8 +112,8 @@ private:
|
|||
// Triggered when the thread has finished ConnectInternal.
|
||||
Common::Event m_thread_ready_event;
|
||||
|
||||
Common::FifoQueue<Report> m_read_reports;
|
||||
Common::FifoQueue<Report> m_write_reports;
|
||||
Common::SPSCQueue<Report> m_read_reports;
|
||||
Common::SPSCQueue<Report> m_write_reports;
|
||||
};
|
||||
|
||||
class WiimoteScannerBackend
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <vector>
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/TraversalClient.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
@ -109,10 +109,10 @@ protected:
|
|||
std::recursive_mutex async_queue_write;
|
||||
} m_crit;
|
||||
|
||||
Common::FifoQueue<sf::Packet, false> m_async_queue;
|
||||
Common::SPSCQueue<sf::Packet, false> m_async_queue;
|
||||
|
||||
std::array<Common::FifoQueue<GCPadStatus>, 4> m_pad_buffer;
|
||||
std::array<Common::FifoQueue<NetWiimote>, 4> m_wiimote_buffer;
|
||||
std::array<Common::SPSCQueue<GCPadStatus>, 4> m_pad_buffer;
|
||||
std::array<Common::SPSCQueue<NetWiimote>, 4> m_wiimote_buffer;
|
||||
|
||||
NetPlayUI* m_dialog = nullptr;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Common/TraversalClient.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
|
@ -114,7 +114,7 @@ private:
|
|||
|
||||
std::string m_selected_game;
|
||||
std::thread m_thread;
|
||||
Common::FifoQueue<sf::Packet, false> m_async_queue;
|
||||
Common::SPSCQueue<sf::Packet, false> m_async_queue;
|
||||
|
||||
ENetHost* m_server = nullptr;
|
||||
TraversalClient* m_traversal_client = nullptr;
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <wx/frame.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
#include "Core/NetPlayClient.h"
|
||||
#include "Core/NetPlayProto.h"
|
||||
#include "Core/NetPlayServer.h"
|
||||
|
@ -161,7 +161,7 @@ private:
|
|||
std::string m_desync_player;
|
||||
|
||||
std::vector<int> m_playerids;
|
||||
Common::FifoQueue<std::string> m_chat_msgs;
|
||||
Common::SPSCQueue<std::string> m_chat_msgs;
|
||||
|
||||
const GameListCtrl* const m_game_list;
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ add_dolphin_test(BlockingLoopTest BlockingLoopTest.cpp)
|
|||
add_dolphin_test(BusyLoopTest BusyLoopTest.cpp)
|
||||
add_dolphin_test(CommonFuncsTest CommonFuncsTest.cpp)
|
||||
add_dolphin_test(EventTest EventTest.cpp)
|
||||
add_dolphin_test(FifoQueueTest FifoQueueTest.cpp)
|
||||
add_dolphin_test(FixedSizeQueueTest FixedSizeQueueTest.cpp)
|
||||
add_dolphin_test(FlagTest FlagTest.cpp)
|
||||
add_dolphin_test(MathUtilTest MathUtilTest.cpp)
|
||||
add_dolphin_test(NandPathsTest NandPathsTest.cpp)
|
||||
add_dolphin_test(SPSCQueueTest SPSCQueueTest.cpp)
|
||||
add_dolphin_test(StringUtilTest StringUtilTest.cpp)
|
||||
add_dolphin_test(SwapTest SwapTest.cpp)
|
||||
add_dolphin_test(x64EmitterTest x64EmitterTest.cpp)
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <thread>
|
||||
|
||||
#include "Common/FifoQueue.h"
|
||||
#include "Common/SPSCQueue.h"
|
||||
|
||||
TEST(FifoQueue, Simple)
|
||||
TEST(SPSCQueue, Simple)
|
||||
{
|
||||
Common::FifoQueue<u32> q;
|
||||
Common::SPSCQueue<u32> q;
|
||||
|
||||
EXPECT_EQ(0u, q.Size());
|
||||
EXPECT_TRUE(q.Empty());
|
||||
|
@ -43,9 +43,9 @@ TEST(FifoQueue, Simple)
|
|||
EXPECT_TRUE(q.Empty());
|
||||
}
|
||||
|
||||
TEST(FifoQueue, MultiThreaded)
|
||||
TEST(SPSCQueue, MultiThreaded)
|
||||
{
|
||||
Common::FifoQueue<u32> q;
|
||||
Common::SPSCQueue<u32> q;
|
||||
|
||||
auto inserter = [&q]() {
|
||||
for (u32 i = 0; i < 100000; ++i)
|
Loading…
Reference in New Issue