mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 12:05:50 +00:00
Move std::cin.tie to main
This commit is contained in:
parent
ee78b527ae
commit
4bf8dbe3ea
@ -830,6 +830,10 @@ void RunQueryDbThread(const std::string& bin_name,
|
|||||||
// |ipc| is connected to a server.
|
// |ipc| is connected to a server.
|
||||||
void LaunchStdinLoop(Config* config,
|
void LaunchStdinLoop(Config* config,
|
||||||
std::unordered_map<IpcId, Timer>* request_times) {
|
std::unordered_map<IpcId, Timer>* request_times) {
|
||||||
|
// If flushing cin requires flushing cout there could be deadlocks in some
|
||||||
|
// clients.
|
||||||
|
std::cin.tie(nullptr);
|
||||||
|
|
||||||
WorkThread::StartThread("stdin", [request_times]() {
|
WorkThread::StartThread("stdin", [request_times]() {
|
||||||
IpcManager* ipc = IpcManager::instance();
|
IpcManager* ipc = IpcManager::instance();
|
||||||
|
|
||||||
@ -956,7 +960,6 @@ void LanguageServerMain(const std::string& bin_name,
|
|||||||
QueueManager queue(waiter);
|
QueueManager queue(waiter);
|
||||||
std::unordered_map<IpcId, Timer> request_times;
|
std::unordered_map<IpcId, Timer> request_times;
|
||||||
|
|
||||||
std::cin.tie(NULL);
|
|
||||||
LaunchStdinLoop(config, &request_times);
|
LaunchStdinLoop(config, &request_times);
|
||||||
|
|
||||||
// We run a dedicated thread for writing to stdout because there can be an
|
// We run a dedicated thread for writing to stdout because there can be an
|
||||||
|
Loading…
Reference in New Issue
Block a user