mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
Add a wr_trylock wrapper for pthread rw lock write trylock.
This commit is contained in:
parent
251e1a98cc
commit
f4cf0939a2
9
miner.h
9
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_unlock(_lock) _mutex_unlock(_lock, __FILE__, __func__, __LINE__)
|
||||||
#define mutex_trylock(_lock) _mutex_trylock(_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_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 rd_lock(_lock) _rd_lock(_lock, __FILE__, __func__, __LINE__)
|
||||||
#define rw_unlock(_lock) _rw_unlock(_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__)
|
#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);
|
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)
|
static inline void _rd_lock(pthread_rwlock_t *lock, const char *file, const char *func, const int line)
|
||||||
{
|
{
|
||||||
GETLOCK(lock, file, func, line);
|
GETLOCK(lock, file, func, line);
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
#define AVALON_TIMEOUT_MS 999
|
#define AVALON_TIMEOUT_MS 999
|
||||||
#define KLONDIKE_TIMEOUT_MS 999
|
#define KLONDIKE_TIMEOUT_MS 999
|
||||||
#define ICARUS_TIMEOUT_MS 999
|
#define ICARUS_TIMEOUT_MS 999
|
||||||
#define AMU_TIMEOUT_MS 1999
|
|
||||||
#define HASHFAST_TIMEOUT_MS 999
|
#define HASHFAST_TIMEOUT_MS 999
|
||||||
#else
|
#else
|
||||||
#define BFLSC_TIMEOUT_MS 300
|
#define BFLSC_TIMEOUT_MS 300
|
||||||
@ -77,7 +76,6 @@
|
|||||||
#define AVALON_TIMEOUT_MS 200
|
#define AVALON_TIMEOUT_MS 200
|
||||||
#define KLONDIKE_TIMEOUT_MS 200
|
#define KLONDIKE_TIMEOUT_MS 200
|
||||||
#define ICARUS_TIMEOUT_MS 200
|
#define ICARUS_TIMEOUT_MS 200
|
||||||
#define AMU_TIMEOUT_MS 200
|
|
||||||
#define HASHFAST_TIMEOUT_MS 200
|
#define HASHFAST_TIMEOUT_MS 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -404,7 +402,7 @@ static struct usb_find_devices find_dev[] = {
|
|||||||
.idVendor = 0x10c4,
|
.idVendor = 0x10c4,
|
||||||
.idProduct = 0xea60,
|
.idProduct = 0xea60,
|
||||||
.config = 1,
|
.config = 1,
|
||||||
.timeout = AMU_TIMEOUT_MS,
|
.timeout = ICARUS_TIMEOUT_MS,
|
||||||
.latency = LATENCY_UNUSED,
|
.latency = LATENCY_UNUSED,
|
||||||
INTINFO(amu_ints) },
|
INTINFO(amu_ints) },
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user