Browse Source

Set last device valid work on adding device.

Con Kolivas 12 years ago
parent
commit
a3bbe0e116
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cgminer.c

+ 5 - 1
cgminer.c

@@ -6979,7 +6979,7 @@ struct _cgpu_devid_counter {
 	UT_hash_handle hh;
 	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;
 	static struct _cgpu_devid_counter *devids = NULL;
 	struct _cgpu_devid_counter *d;
 	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));
 	devices = realloc(devices, sizeof(struct cgpu_info *) * (total_devices + new_devices + 2));
 	wr_unlock(&devices_lock);
 	wr_unlock(&devices_lock);
 
 
+	mutex_lock(&stats_lock);
+	cgpu->last_device_valid_work = time(NULL);
+	mutex_unlock(&stats_lock);
+
 	if (hotplug_mode)
 	if (hotplug_mode)
 		devices[total_devices + new_devices++] = cgpu;
 		devices[total_devices + new_devices++] = cgpu;
 	else
 	else