1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-28 23:44:30 +00:00

Provide locking around updates of cgpu hashrates as well to prevent multiple threads accessing data fields on the same device.

This commit is contained in:
Con Kolivas 2012-03-28 21:58:04 +11:00
parent fa5e0675d6
commit ef1eafa40a

View File

@ -2936,8 +2936,10 @@ static void hashmeter(int thr_id, struct timeval *diff,
if (th->cgpu == cgpu) if (th->cgpu == cgpu)
thread_rolling += th->rolling; thread_rolling += th->rolling;
} }
mutex_lock(&hash_lock);
decay_time(&cgpu->rolling, thread_rolling); decay_time(&cgpu->rolling, thread_rolling);
cgpu->total_mhashes += local_mhashes; cgpu->total_mhashes += local_mhashes;
mutex_unlock(&hash_lock);
// If needed, output detailed, per-device stats // If needed, output detailed, per-device stats
if (want_per_device_stats) { if (want_per_device_stats) {