Multi-core POW
This commit is contained in:
parent
ad2457361f
commit
a99e3d7780
|
@ -29,11 +29,11 @@ def run(target, initialHash):
|
||||||
for i in range(pool_size):
|
for i in range(pool_size):
|
||||||
result.append(pool.apply_async(_pool_worker, args = (i, initialHash, target, pool_size)))
|
result.append(pool.apply_async(_pool_worker, args = (i, initialHash, target, pool_size)))
|
||||||
while True:
|
while True:
|
||||||
for i in range(pool_size):
|
|
||||||
if shared.shutdown:
|
if shared.shutdown:
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
time.sleep(5) #Don't return anything (doing so will cause exceptions because we'll return an unusable response). Sit here and wait for this thread to close.
|
time.sleep(5) #Don't return anything (doing so will cause exceptions because we'll return an unusable response). Sit here and wait for this thread to close.
|
||||||
return
|
return
|
||||||
|
for i in range(pool_size):
|
||||||
if result[i].ready():
|
if result[i].ready():
|
||||||
result = result[i].get()
|
result = result[i].get()
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user