mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
API use control_lock when switching pools
This commit is contained in:
parent
cb49f3cbb7
commit
419083a7d2
3
api.c
3
api.c
@ -2301,13 +2301,16 @@ static void switchpool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
id = atoi(param);
|
id = atoi(param);
|
||||||
|
mutex_lock(&control_lock);
|
||||||
if (id < 0 || id >= total_pools) {
|
if (id < 0 || id >= total_pools) {
|
||||||
|
mutex_unlock(&control_lock);
|
||||||
message(io_data, MSG_INVPID, id, NULL, isjson);
|
message(io_data, MSG_INVPID, id, NULL, isjson);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = pools[id];
|
pool = pools[id];
|
||||||
pool->enabled = POOL_ENABLED;
|
pool->enabled = POOL_ENABLED;
|
||||||
|
mutex_unlock(&control_lock);
|
||||||
switch_pools(pool);
|
switch_pools(pool);
|
||||||
|
|
||||||
message(io_data, MSG_SWITCHP, id, NULL, isjson);
|
message(io_data, MSG_SWITCHP, id, NULL, isjson);
|
||||||
|
1
miner.h
1
miner.h
@ -754,6 +754,7 @@ extern int opt_expiry;
|
|||||||
extern pthread_mutex_t cgusb_lock;
|
extern pthread_mutex_t cgusb_lock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern pthread_mutex_t control_lock;
|
||||||
extern pthread_mutex_t hash_lock;
|
extern pthread_mutex_t hash_lock;
|
||||||
extern pthread_mutex_t console_lock;
|
extern pthread_mutex_t console_lock;
|
||||||
extern pthread_mutex_t ch_lock;
|
extern pthread_mutex_t ch_lock;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user