mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 06:48:33 +00:00
rewrite tapserver interface for better error handling
This commit is contained in:
parent
a36600ae50
commit
083116a89c
6 changed files with 223 additions and 57 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue