From d10699d4c33de94f985b4af4502e1649b837b213 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 1 Nov 2012 14:24:55 +1100 Subject: [PATCH] Add a gbt mutex within the pool struct for protecting the gbt values. --- cgminer.c | 7 +++---- miner.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cgminer.c b/cgminer.c index 946b654f..10c6a5b3 100644 --- a/cgminer.c +++ b/cgminer.c @@ -420,12 +420,11 @@ struct pool *add_pool(void) pool->pool_no = pool->prio = total_pools; pools = realloc(pools, sizeof(struct pool *) * (total_pools + 2)); pools[total_pools++] = pool; - if (unlikely(pthread_mutex_init(&pool->pool_lock, NULL))) - quit(1, "Failed to pthread_mutex_init in add_pool"); + mutex_init(&pool->pool_lock); if (unlikely(pthread_cond_init(&pool->cr_cond, NULL))) quit(1, "Failed to pthread_cond_init in add_pool"); - if (unlikely(pthread_mutex_init(&pool->stratum_lock, NULL))) - quit(1, "Failed to pthread_mutex_init in add_pool"); + mutex_init(&pool->stratum_lock); + mutex_init(&pool->gbt_lock); INIT_LIST_HEAD(&pool->curlring); /* Make sure the pool doesn't think we've been idle since time 0 */ diff --git a/miner.h b/miner.h index e608c13c..278b2be8 100644 --- a/miner.h +++ b/miner.h @@ -886,6 +886,7 @@ struct pool { /* GBT variables */ bool has_gbt; + pthread_mutex_t gbt_lock; }; #define GETWORK_MODE_TESTPOOL 'T'