mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
NetPlay: Remove RunOnThread and add SendAsync methods
Add std::unique_ptr<sf::Packet> objects to a queue instead of functions, makes things easier to read, and avoids headaches while checking the lifetime of the concerned objects.
This commit is contained in:
@ -48,7 +48,7 @@ class NetPlayClient : public TraversalClientClient
|
||||
{
|
||||
public:
|
||||
void ThreadFunc();
|
||||
void RunOnThread(std::function<void()> func);
|
||||
void SendAsync(sf::Packet* packet);
|
||||
|
||||
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, std::string centralServer, u16 centralPort);
|
||||
~NetPlayClient();
|
||||
@ -95,10 +95,10 @@ protected:
|
||||
std::recursive_mutex game;
|
||||
// lock order
|
||||
std::recursive_mutex players;
|
||||
std::recursive_mutex run_queue_write;
|
||||
std::recursive_mutex async_queue_write;
|
||||
} m_crit;
|
||||
|
||||
Common::FifoQueue<std::function<void()>, false> m_run_queue;
|
||||
Common::FifoQueue<std::unique_ptr<sf::Packet>, false> m_async_queue;
|
||||
|
||||
Common::FifoQueue<GCPadStatus> m_pad_buffer[4];
|
||||
Common::FifoQueue<NetWiimote> m_wiimote_buffer[4];
|
||||
|
Reference in New Issue
Block a user