mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Yield after releasing a lock in case we are on a device with limited CPU resources.
This commit is contained in:
parent
261b1299ac
commit
0aeb1b5480
4
miner.h
4
miner.h
@ -9,6 +9,8 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
#include <sched.h>
|
||||||
|
|
||||||
#include "elist.h"
|
#include "elist.h"
|
||||||
#include "uthash.h"
|
#include "uthash.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
@ -721,6 +723,7 @@ static inline void mutex_unlock(pthread_mutex_t *lock)
|
|||||||
{
|
{
|
||||||
if (unlikely(pthread_mutex_unlock(lock)))
|
if (unlikely(pthread_mutex_unlock(lock)))
|
||||||
quit(1, "WTF MUTEX ERROR ON UNLOCK!");
|
quit(1, "WTF MUTEX ERROR ON UNLOCK!");
|
||||||
|
sched_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int mutex_trylock(pthread_mutex_t *lock)
|
static inline int mutex_trylock(pthread_mutex_t *lock)
|
||||||
@ -744,6 +747,7 @@ static inline void rw_unlock(pthread_rwlock_t *lock)
|
|||||||
{
|
{
|
||||||
if (unlikely(pthread_rwlock_unlock(lock)))
|
if (unlikely(pthread_rwlock_unlock(lock)))
|
||||||
quit(1, "WTF RWLOCK ERROR ON UNLOCK!");
|
quit(1, "WTF RWLOCK ERROR ON UNLOCK!");
|
||||||
|
sched_yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void rd_unlock(pthread_rwlock_t *lock)
|
static inline void rd_unlock(pthread_rwlock_t *lock)
|
||||||
|
Loading…
Reference in New Issue
Block a user