mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Make sure to start the getwork and submit threads when a pool is added on the fly.
This commit is contained in:
parent
5ad942d187
commit
f9123f0587
17
cgminer.c
17
cgminer.c
@ -384,16 +384,12 @@ static void add_pool(void)
|
||||
struct pool *pool;
|
||||
|
||||
pool = calloc(sizeof(struct pool), 1);
|
||||
if (!pool) {
|
||||
applog(LOG_ERR, "Failed to malloc pool in add_pool");
|
||||
exit (1);
|
||||
}
|
||||
if (!pool)
|
||||
quit(1, "Failed to malloc pool in add_pool");
|
||||
pool->pool_no = pool->prio = total_pools;
|
||||
pools[total_pools++] = pool;
|
||||
if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) {
|
||||
applog(LOG_ERR, "Failed to pthread_mutex_init in add_pool");
|
||||
exit (1);
|
||||
}
|
||||
if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL)))
|
||||
quit(1, "Failed to pthread_mutex_init in add_pool");
|
||||
/* Make sure the pool doesn't think we've been idle since time 0 */
|
||||
pool->tv_idle.tv_sec = ~0UL;
|
||||
|
||||
@ -4457,6 +4453,11 @@ int add_pool_details(bool live, char *url, char *user, char *pass)
|
||||
|
||||
pool->tv_idle.tv_sec = ~0UL;
|
||||
|
||||
if (unlikely(pthread_create(&pool->submit_thread, NULL, submit_work_thread, (void *)pool)))
|
||||
quit(1, "Failed to create pool submit thread");
|
||||
if (unlikely(pthread_create(&pool->getwork_thread, NULL, get_work_thread, (void *)pool)))
|
||||
quit(1, "Failed to create pool getwork thread");
|
||||
|
||||
/* Test the pool is not idle if we're live running, otherwise
|
||||
* it will be tested separately */
|
||||
pool->enabled = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user