From 86b976dfa51a4d78669ce1f34eb5f6f4ce876ec3 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Tue, 17 Apr 2018 22:38:14 +0200 Subject: fix wrong unique_lock usage clang warns about the wrong usage: ``` ``` xmrstak/net/jpsock.cpp:232:30: warning: parentheses were disambiguated as redundant parentheses around declaration of variable named 'job_mutex' [-Wvexing-parse] std::unique_lock(job_mutex); ^~~~~~~~~~~ xmrstak/net/jpsock.cpp:232:30: note: add a variable name to declare a 'std::unique_lock' initialized with 'job_mutex' std::unique_lock(job_mutex); ``` --- xmrstak/net/jpsock.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp index d71aeb1..74d1c26 100644 --- a/xmrstak/net/jpsock.cpp +++ b/xmrstak/net/jpsock.cpp @@ -229,7 +229,7 @@ void jpsock::jpsock_thread() else disconnect_time = 0; - std::unique_lock(job_mutex); + std::unique_lock lck(job_mutex); memset(&oCurrentJob, 0, sizeof(oCurrentJob)); bRunning = false; } @@ -439,7 +439,7 @@ bool jpsock::process_pool_job(const opq_json_val* params) if(motd != nullptr && motd->IsString() && (motd->GetStringLength() & 0x01) == 0) { - std::unique_lock(motd_mutex); + std::unique_lock lck(motd_mutex); if(motd->GetStringLength() > 0) { pool_motd.resize(motd->GetStringLength()/2 + 1); @@ -454,7 +454,7 @@ bool jpsock::process_pool_job(const opq_json_val* params) executor::inst()->push_event(ex_event(oPoolJob, pool_id)); - std::unique_lock(job_mutex); + std::unique_lock lck(job_mutex); oCurrentJob = oPoolJob; return true; } @@ -679,13 +679,13 @@ bool jpsock::cmd_submit(const char* sJobId, uint32_t iNonce, const uint8_t* bRes void jpsock::save_nonce(uint32_t nonce) { - std::unique_lock(job_mutex); + std::unique_lock lck(job_mutex); oCurrentJob.iSavedNonce = nonce; } bool jpsock::get_current_job(pool_job& job) { - std::unique_lock(job_mutex); + std::unique_lock lck(job_mutex); if(oCurrentJob.iWorkLen == 0) return false; @@ -699,7 +699,7 @@ bool jpsock::get_pool_motd(std::string& strin) if(!ext_motd) return false; - std::unique_lock(motd_mutex); + std::unique_lock lck(motd_mutex); if(pool_motd.size() > 0) { strin.assign(pool_motd); -- cgit v1.1