It is not critical getting the temperature response in bitforce so don't mandatorily wait on the mutex lock.
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 7424b08..88beed4 100644
--- a/driver-bitforce.c
+++ b/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);
diff --git a/miner.h b/miner.h
index 09cb503..02c488d 100644
--- a/miner.h
+++ b/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)))