mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-02 15:45:58 +00:00
Merge pull request #12355 from fuzziqersoftware/tapserver-modem-adapter
Implement tapserver-based modem adapter
This commit is contained in:
commit
b510ac89a3
23 changed files with 1283 additions and 161 deletions
|
@ -8,12 +8,27 @@ namespace Common
|
|||
#ifdef _WIN32
|
||||
SocketContext::SocketContext()
|
||||
{
|
||||
static_cast<void>(WSAStartup(MAKEWORD(2, 2), &m_data));
|
||||
std::lock_guard<std::mutex> g(s_lock);
|
||||
if (s_num_objects == 0)
|
||||
{
|
||||
static_cast<void>(WSAStartup(MAKEWORD(2, 2), &s_data));
|
||||
}
|
||||
s_num_objects++;
|
||||
}
|
||||
SocketContext::~SocketContext()
|
||||
{
|
||||
WSACleanup();
|
||||
std::lock_guard<std::mutex> g(s_lock);
|
||||
s_num_objects--;
|
||||
if (s_num_objects == 0)
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
}
|
||||
|
||||
std::mutex SocketContext::s_lock;
|
||||
size_t SocketContext::s_num_objects = 0;
|
||||
WSADATA SocketContext::s_data;
|
||||
|
||||
#else
|
||||
SocketContext::SocketContext() = default;
|
||||
SocketContext::~SocketContext() = default;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <WinSock2.h>
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
||||
namespace Common
|
||||
|
@ -23,7 +24,9 @@ public:
|
|||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
WSADATA m_data;
|
||||
static std::mutex s_lock;
|
||||
static size_t s_num_objects;
|
||||
static WSADATA s_data;
|
||||
#endif
|
||||
};
|
||||
} // namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue