Browse Source

Do as much outside of mutex locking of sshare_lock as possible.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
7e8019acdd
  1. 10
      cgminer.c

10
cgminer.c

@ -3156,17 +3156,19 @@ static void *submit_work_thread(void *userdata) @@ -3156,17 +3156,19 @@ static void *submit_work_thread(void *userdata)
sshare->sshare_time = time(NULL);
/* This work item is freed in parse_stratum_response */
sshare->work = work;
nonce = *((uint32_t *)(work->data + 76));
noncehex = bin2hex((const unsigned char *)&nonce, 4);
memset(s, 0, 1024);
h32 = hash32[6];
mutex_lock(&sshare_lock);
/* Give the stratum share a unique id */
sshare->id = swork_id++;
HASH_ADD_INT(stratum_shares, id, sshare);
nonce = *((uint32_t *)(work->data + 76));
noncehex = bin2hex((const unsigned char *)&nonce, 4);
memset(s, 0, 1024);
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
h32 = hash32[6];
mutex_unlock(&sshare_lock);
free(noncehex);
applog(LOG_INFO, "Submitting share %08lx to pool %d", h32, pool->pool_no);

Loading…
Cancel
Save