1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 13:04:29 +00:00

Make sure to start the getwork and submit threads when a pool is added on the fly.

This commit is contained in:
Con Kolivas 2012-04-29 08:55:59 +10:00
parent 5ad942d187
commit f9123f0587

View File

@ -384,16 +384,12 @@ static void add_pool(void)
struct pool *pool; struct pool *pool;
pool = calloc(sizeof(struct pool), 1); pool = calloc(sizeof(struct pool), 1);
if (!pool) { if (!pool)
applog(LOG_ERR, "Failed to malloc pool in add_pool"); quit(1, "Failed to malloc pool in add_pool");
exit (1);
}
pool->pool_no = pool->prio = total_pools; pool->pool_no = pool->prio = total_pools;
pools[total_pools++] = pool; pools[total_pools++] = pool;
if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) { if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL)))
applog(LOG_ERR, "Failed to pthread_mutex_init in add_pool"); quit(1, "Failed to pthread_mutex_init in add_pool");
exit (1);
}
/* Make sure the pool doesn't think we've been idle since time 0 */ /* Make sure the pool doesn't think we've been idle since time 0 */
pool->tv_idle.tv_sec = ~0UL; 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; 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 /* Test the pool is not idle if we're live running, otherwise
* it will be tested separately */ * it will be tested separately */
pool->enabled = true; pool->enabled = true;