mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 15:05:59 +00:00
Win32: Fix deadlock on std::cerr usage
This commit is contained in:
parent
51e1598e42
commit
b55f38290b
3 changed files with 30 additions and 4 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
void attach_console([[maybe_unused]] int stream, [[maybe_unused]] bool open_console)
|
||||
|
|
@ -34,6 +36,26 @@ namespace utils
|
|||
{
|
||||
[[maybe_unused]] const auto con_in = freopen("CONIN$", "r", stdin);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void output_stderr(std::string_view str, bool with_endline)
|
||||
{
|
||||
if (with_endline)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::clog << str;
|
||||
#else
|
||||
std::cerr << str;
|
||||
#endif
|
||||
str = "\n";
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Flush seems broken on Windows (deadlocks)
|
||||
std::clog << str;
|
||||
#else
|
||||
std::cerr << str;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue