1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

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

This commit is contained in:
Con Kolivas 2012-08-03 09:26:43 +10:00
parent 5118e3ee7c
commit 7fa794a499
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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)))