mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-08 19:59:30 +00:00
Console: fixed data race
This commit is contained in:
parent
58d32ffd1f
commit
98a9eb4f18
1 changed files with 14 additions and 12 deletions
|
@ -63,12 +63,18 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
|
|||
throw std::exception();
|
||||
}
|
||||
|
||||
int err = uv_thread_create(&m_loopThread, loop, this);
|
||||
if (err) {
|
||||
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
|
||||
PANIC_STOP();
|
||||
if (m_pool->api() && m_pool->params().m_localStats) {
|
||||
m_pool->api()->set(p2pool_api::Category::LOCAL, "console",
|
||||
[stdin_type, this](log::Stream& s)
|
||||
{
|
||||
s << "{\"mode\":" << ((stdin_type == UV_TTY) ? "\"tty\"" : "\"pipe\"")
|
||||
<< ",\"tcp_port\":" << m_listenPort
|
||||
<< "}";
|
||||
});
|
||||
}
|
||||
|
||||
int err;
|
||||
|
||||
if (stdin_type == UV_TTY) {
|
||||
LOGINFO(3, "processing stdin as UV_TTY");
|
||||
err = uv_tty_init(&m_loop, &m_tty, 0, 1);
|
||||
|
@ -100,14 +106,10 @@ ConsoleCommands::ConsoleCommands(p2pool* pool)
|
|||
throw std::exception();
|
||||
}
|
||||
|
||||
if (m_pool->api() && m_pool->params().m_localStats) {
|
||||
m_pool->api()->set(p2pool_api::Category::LOCAL, "console",
|
||||
[stdin_type, this](log::Stream& s)
|
||||
{
|
||||
s << "{\"mode\":" << ((stdin_type == UV_TTY) ? "\"tty\"" : "\"pipe\"")
|
||||
<< ",\"tcp_port\":" << m_listenPort
|
||||
<< "}";
|
||||
});
|
||||
err = uv_thread_create(&m_loopThread, loop, this);
|
||||
if (err) {
|
||||
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
|
||||
throw std::exception();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue