Multi-core POW

This commit is contained in:
Jonathan Warren 2013-05-30 16:42:24 -04:00
parent ad2457361f
commit a99e3d7780

View File

@ -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:
if shared.shutdown:
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.
return
for i in range(pool_size): for i in range(pool_size):
if shared.shutdown:
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.
return
if result[i].ready(): if result[i].ready():
result = result[i].get() result = result[i].get()
pool.terminate() pool.terminate()