1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 23:37:54 +00:00

Unlock the sshare_lock in submit_work_thread when all references to work and sshare are complete.

This commit is contained in:
Con Kolivas 2013-02-15 16:05:21 +11:00
parent 1bf1f4a217
commit ebb99e5a8d

View File

@ -3160,13 +3160,12 @@ static void *submit_work_thread(void *userdata)
/* Give the stratum share a unique id */ /* Give the stratum share a unique id */
sshare->id = swork_id++; sshare->id = swork_id++;
HASH_ADD_INT(stratum_shares, id, sshare); HASH_ADD_INT(stratum_shares, id, sshare);
mutex_unlock(&sshare_lock);
nonce = *((uint32_t *)(work->data + 76)); nonce = *((uint32_t *)(work->data + 76));
noncehex = bin2hex((const unsigned char *)&nonce, 4); noncehex = bin2hex((const unsigned char *)&nonce, 4);
memset(s, 0, 1024); memset(s, 0, 1024);
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}", 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); pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
mutex_unlock(&sshare_lock);
free(noncehex); free(noncehex);
applog(LOG_INFO, "Submitting share %08lx to pool %d", (unsigned long)(hash32[6]), pool->pool_no); applog(LOG_INFO, "Submitting share %08lx to pool %d", (unsigned long)(hash32[6]), pool->pool_no);