Browse Source

It is not critical getting the temperature response in bitforce so don't mandatorily wait on the mutex lock.

Con Kolivas 13 years ago
parent
commit
7fa794a499
2 changed files with 10 additions and 1 deletions
  1. 5 1
      driver-bitforce.c
  2. 5 0
      miner.h

+ 5 - 1
driver-bitforce.c

@@ -241,7 +241,11 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
 	if (!fdDev)
 		return false;
 
-	mutex_lock(&bitforce->device_mutex);
+	/* It is not critical getting temperature so don't get stuck if  we
+	 * can't grab the mutex here */
+	if (mutex_trylock(&bitforce->device_mutex))
+		return false;
+
 	BFwrite(fdDev, "ZLX", 3);
 	BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
 	mutex_unlock(&bitforce->device_mutex);

+ 5 - 0
miner.h

@@ -500,6 +500,11 @@ static inline void mutex_unlock(pthread_mutex_t *lock)
 		quit(1, "WTF MUTEX ERROR ON UNLOCK!");
 }
 
+static inline int mutex_trylock(pthread_mutex_t *lock)
+{
+	return pthread_mutex_trylock(lock);
+}
+
 static inline void wr_lock(pthread_rwlock_t *lock)
 {
 	if (unlikely(pthread_rwlock_wrlock(lock)))