mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Protect the best_share/best_diff values under control lock.
This commit is contained in:
parent
368f503f5f
commit
3b910336ce
@ -2352,10 +2352,12 @@ static uint64_t share_diff(const struct work *work)
|
||||
if (unlikely(!d64))
|
||||
d64 = 1;
|
||||
ret = diffone / d64;
|
||||
mutex_lock(&control_lock);
|
||||
if (ret > best_diff) {
|
||||
best_diff = ret;
|
||||
suffix_string(best_diff, best_share, 0);
|
||||
}
|
||||
mutex_unlock(&control_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -2367,10 +2369,12 @@ static uint64_t scrypt_diff(const struct work *work)
|
||||
if (unlikely(!d64))
|
||||
d64 = 1;
|
||||
ret = scrypt_diffone / d64;
|
||||
mutex_lock(&control_lock);
|
||||
if (ret > best_diff) {
|
||||
best_diff = ret;
|
||||
suffix_string(best_diff, best_share, 0);
|
||||
}
|
||||
mutex_unlock(&control_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user