summaryrefslogtreecommitdiffstats
path: root/xmrstak/net/jpsock.cpp
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-05-07 22:57:45 +0200
committerTimothy Pearson <tpearson@raptorengineering.com>2018-06-04 21:07:11 +0000
commitdac939f4fa5e0f625fa7ebf8fc738bf5c4e66920 (patch)
treeac99aa7b8a3548536664bacf18efe15195a9da5d /xmrstak/net/jpsock.cpp
parent7737b8ebe1a897718eb3f8fdf79cfee0da68afbd (diff)
downloadxmr-stak-dac939f4fa5e0f625fa7ebf8fc738bf5c4e66920.zip
xmr-stak-dac939f4fa5e0f625fa7ebf8fc738bf5c4e66920.tar.gz
fix possible race condition in jpsock
Trigger event with a new job after the current pool job is updated.
Diffstat (limited to 'xmrstak/net/jpsock.cpp')
-rw-r--r--xmrstak/net/jpsock.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/xmrstak/net/jpsock.cpp b/xmrstak/net/jpsock.cpp
index f9217c5..7f7e833 100644
--- a/xmrstak/net/jpsock.cpp
+++ b/xmrstak/net/jpsock.cpp
@@ -452,10 +452,12 @@ bool jpsock::process_pool_job(const opq_json_val* params)
iJobDiff = t64_to_diff(oPoolJob.iTarget);
- executor::inst()->push_event(ex_event(oPoolJob, pool_id));
-
std::unique_lock<std::mutex> lck(job_mutex);
oCurrentJob = oPoolJob;
+ lck.unlock();
+ // send event after current job data are updated
+ executor::inst()->push_event(ex_event(oPoolJob, pool_id));
+
return true;
}
OpenPOWER on IntegriCloud