Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9559 from iwubcode/gdb-stub-raii
Common / Core: add raii object that cleans up WSA on destruction in gdb-stub
- Loading branch information
Showing
7 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2021 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "Common/SocketContext.h" | ||
|
||
namespace Common | ||
{ | ||
#ifdef _WIN32 | ||
SocketContext::SocketContext() | ||
{ | ||
static_cast<void>(WSAStartup(MAKEWORD(2, 2), &m_data)); | ||
} | ||
SocketContext::~SocketContext() | ||
{ | ||
WSACleanup(); | ||
} | ||
#else | ||
SocketContext::SocketContext() = default; | ||
SocketContext::~SocketContext() = default; | ||
#endif | ||
} // namespace Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2021 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#ifdef _WIN32 | ||
#include <WinSock2.h> | ||
#endif | ||
|
||
namespace Common | ||
{ | ||
class SocketContext | ||
{ | ||
public: | ||
SocketContext(); | ||
~SocketContext(); | ||
|
||
SocketContext(const SocketContext&) = delete; | ||
SocketContext(SocketContext&&) = delete; | ||
|
||
SocketContext& operator=(const SocketContext&) = delete; | ||
SocketContext& operator=(SocketContext&&) = delete; | ||
|
||
private: | ||
#ifdef _WIN32 | ||
WSADATA m_data; | ||
#endif | ||
}; | ||
} // namespace Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters