aboutsummaryrefslogtreecommitdiff
path: root/sha256_4way.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-03-17 22:02:28 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-03-17 22:02:28 -0400
commit2d49a9a5d767b85981ce73f1832e0eae06d0d52f (patch)
tree2281b3960552a6fcb14a62f60bbe09b0fafa5227 /sha256_4way.c
parent4be41af2be1b2442161a98b9d7fbf2a61cc854f9 (diff)
Introduce ability to interrupt hash scanners in the middle of scanning.
Diffstat (limited to 'sha256_4way.c')
-rw-r--r--sha256_4way.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sha256_4way.c b/sha256_4way.c
index 742682f..6d42451 100644
--- a/sha256_4way.c
+++ b/sha256_4way.c
@@ -100,7 +100,8 @@ static const unsigned int pSHA256InitState[8] =
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
-unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate, unsigned char *pdata,
+unsigned int ScanHash_4WaySSE2(int thr_id, const unsigned char *pmidstate,
+ unsigned char *pdata,
unsigned char *phash1, unsigned char *phash,
const unsigned char *ptarget,
uint32_t max_nonce, unsigned long *nHashesDone)
@@ -108,6 +109,8 @@ unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate, unsigned char *pd
unsigned int *nNonce_p = (unsigned int*)(pdata + 12);
unsigned int nonce = 0;
+ work_restart[thr_id].restart = 0;
+
for (;;)
{
unsigned int thash[9][NPAR] __attribute__((aligned(128)));
@@ -135,7 +138,7 @@ unsigned int ScanHash_4WaySSE2(const unsigned char *pmidstate, unsigned char *pd
}
}
- if (nonce >= max_nonce)
+ if ((nonce >= max_nonce) || work_restart[thr_id].restart)
{
*nHashesDone = nonce;
return -1;