From a3bbe0e1163945c9be2084d4355f60d48298ee29 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 18 Apr 2013 18:19:35 +1000 Subject: [PATCH] Set last device valid work on adding device. --- cgminer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cgminer.c b/cgminer.c index a2ef4d81..2833e8aa 100644 --- a/cgminer.c +++ b/cgminer.c @@ -6979,7 +6979,7 @@ struct _cgpu_devid_counter { UT_hash_handle hh; }; -bool add_cgpu(struct cgpu_info*cgpu) +bool add_cgpu(struct cgpu_info *cgpu) { static struct _cgpu_devid_counter *devids = NULL; struct _cgpu_devid_counter *d; @@ -6998,6 +6998,10 @@ bool add_cgpu(struct cgpu_info*cgpu) devices = realloc(devices, sizeof(struct cgpu_info *) * (total_devices + new_devices + 2)); wr_unlock(&devices_lock); + mutex_lock(&stats_lock); + cgpu->last_device_valid_work = time(NULL); + mutex_unlock(&stats_lock); + if (hotplug_mode) devices[total_devices + new_devices++] = cgpu; else