Skip to content

Commit b0ed252

Browse files
try to deal with possible deadlocks
1 parent d54d05a commit b0ed252

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cmake global
22
cmake_minimum_required(VERSION 2.8.12)
33

4-
set(PROJECT_VERSION "2.1.10")
4+
set(PROJECT_VERSION "2.1.11")
55
if (${CMAKE_VERSION} VERSION_GREATER 3.0)
66
cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH
77
cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project()

libethcore/Farm.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ class GenericFarm
606606
bool submitProof(h256 _nonce, Miner* _m)
607607
{
608608
// return true if miner should stop and wait for new work, false to keep mining
609+
609610
bool shouldStop = false;
610611

611612
LogF << "Trace: GenericFarm.submitProof - nonce = " << _nonce.hex().substr(0, 8) << ", miner = " << _m->index();
@@ -617,7 +618,7 @@ class GenericFarm
617618
- setWork has been called with a new work package
618619
*/
619620

620-
WriteGuard l(x_minerWork);
621+
Guard l(x_solution);
621622

622623
// check to see if the main loop is still processing a previous solution
623624
if (solutionMiner == -1)
@@ -627,6 +628,7 @@ class GenericFarm
627628
solution = _nonce;
628629
if (m_opMode == OperationMode::Solo)
629630
{
631+
WriteGuard lck(x_minerWork);
630632
m_challenge.clear();
631633
for (auto const& m : m_miners)
632634
if (m != _m)
@@ -649,7 +651,7 @@ class GenericFarm
649651
{
650652
// check if any of the miners has found a solution
651653

652-
WriteGuard l(x_minerWork);
654+
Guard l(x_solution);
653655

654656
if (solutionMiner != -1)
655657
{
@@ -710,6 +712,7 @@ class GenericFarm
710712

711713
h256 solution;
712714
int solutionMiner = -1;
715+
mutable Mutex x_solution;
713716

714717
};
715718

0 commit comments

Comments
 (0)