PoW init reordering

- inited by the worker thread on its own init, instead of when the
imports are being evaluated
- also got rid of windows-style newlines in OpenCL PoW
This commit is contained in:
Peter Šurda 2017-08-15 12:24:43 +02:00
parent 58b47bc6de
commit a48dff3bee
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
3 changed files with 114 additions and 112 deletions

View File

@ -42,6 +42,7 @@ class singleWorker(threading.Thread, StoppableThread):
# QThread.__init__(self, parent) # QThread.__init__(self, parent)
threading.Thread.__init__(self, name="singleWorker") threading.Thread.__init__(self, name="singleWorker")
self.initStop() self.initStop()
proofofwork.init()
def stopThread(self): def stopThread(self):
try: try:

View File

@ -100,7 +100,7 @@ def do_opencl_pow(hash, target):
# logger.debug("Took %d tries.", progress) # logger.debug("Took %d tries.", progress)
return output[0][0] return output[0][0]
initCL() #initCL()
if __name__ == "__main__": if __name__ == "__main__":
target = 54227212183L target = 54227212183L

View File

@ -237,6 +237,9 @@ def resetPoW():
# init # init
def init(): def init():
global bitmsglib, bso, bmpow global bitmsglib, bso, bmpow
openclpow.initCL()
if "win32" == sys.platform: if "win32" == sys.platform:
if ctypes.sizeof(ctypes.c_voidp) == 4: if ctypes.sizeof(ctypes.c_voidp) == 4:
bitmsglib = 'bitmsghash32.dll' bitmsglib = 'bitmsghash32.dll'
@ -286,7 +289,5 @@ def init():
bmpow = None bmpow = None
else: else:
bmpow = None bmpow = None
init()
if bmpow is None: if bmpow is None:
buildCPoW() buildCPoW()