diff --git a/miner.h b/miner.h index f81f3d7d..2b0a1730 100644 --- a/miner.h +++ b/miner.h @@ -798,6 +798,7 @@ extern void api_initlock(void *lock, enum cglock_typ typ, const char *file, cons #define mutex_unlock(_lock) _mutex_unlock(_lock, __FILE__, __func__, __LINE__) #define mutex_trylock(_lock) _mutex_trylock(_lock, __FILE__, __func__, __LINE__) #define wr_lock(_lock) _wr_lock(_lock, __FILE__, __func__, __LINE__) +#define wr_trylock(_lock) _wr_trylock(_lock, __FILE__, __func__, __LINE__) #define rd_lock(_lock) _rd_lock(_lock, __FILE__, __func__, __LINE__) #define rw_unlock(_lock) _rw_unlock(_lock, __FILE__, __func__, __LINE__) #define rd_unlock_noyield(_lock) _rd_unlock_noyield(_lock, __FILE__, __func__, __LINE__) @@ -855,6 +856,14 @@ static inline void _wr_lock(pthread_rwlock_t *lock, const char *file, const char GOTLOCK(lock, file, func, line); } +static inline int _wr_trylock(pthread_rwlock_t *lock, __maybe_unused const char *file, __maybe_unused const char *func, __maybe_unused const int line) +{ + TRYLOCK(lock, file, func, line); + int ret = pthread_rwlock_trywrlock(lock); + DIDLOCK(ret, lock, file, func, line); + return ret; +} + static inline void _rd_lock(pthread_rwlock_t *lock, const char *file, const char *func, const int line) { GETLOCK(lock, file, func, line); diff --git a/usbutils.c b/usbutils.c index cf05072a..320db888 100644 --- a/usbutils.c +++ b/usbutils.c @@ -67,7 +67,6 @@ #define AVALON_TIMEOUT_MS 999 #define KLONDIKE_TIMEOUT_MS 999 #define ICARUS_TIMEOUT_MS 999 -#define AMU_TIMEOUT_MS 1999 #define HASHFAST_TIMEOUT_MS 999 #else #define BFLSC_TIMEOUT_MS 300 @@ -77,7 +76,6 @@ #define AVALON_TIMEOUT_MS 200 #define KLONDIKE_TIMEOUT_MS 200 #define ICARUS_TIMEOUT_MS 200 -#define AMU_TIMEOUT_MS 200 #define HASHFAST_TIMEOUT_MS 200 #endif @@ -404,7 +402,7 @@ static struct usb_find_devices find_dev[] = { .idVendor = 0x10c4, .idProduct = 0xea60, .config = 1, - .timeout = AMU_TIMEOUT_MS, + .timeout = ICARUS_TIMEOUT_MS, .latency = LATENCY_UNUSED, INTINFO(amu_ints) }, {