aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-08-26 19:28:41 +0200
committerKarel Kočí <cynerd@email.cz>2015-08-26 20:02:59 +0200
commit17e178eae3b0a39ef5eda09b0c2ed4811c405a85 (patch)
tree7317faf37d5028856ba02c603de3c557b193bc63
parent59a1d7d09796a3f38fe036a9a673ce29876d3420 (diff)
downloadlinux-conf-perf-17e178eae3b0a39ef5eda09b0c2ed4811c405a85.tar.gz
linux-conf-perf-17e178eae3b0a39ef5eda09b0c2ed4811c405a85.tar.bz2
linux-conf-perf-17e178eae3b0a39ef5eda09b0c2ed4811c405a85.zip
Fix thread alive check
-rwxr-xr-xscripts/loop.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/loop.py b/scripts/loop.py
index 70004d5..9161165 100755
--- a/scripts/loop.py
+++ b/scripts/loop.py
@@ -53,6 +53,8 @@ __conflist__ = []
__listlock__ = Lock()
class prepareThread(Thread):
+ global __preparethread__
+ global __measurethread__
def __init__(self, name='prepare'):
Thread.__init__(self, name=name)
def run(self):
@@ -66,12 +68,15 @@ class prepareThread(Thread):
return
__listlock__.acquire()
__conflist__.append((img, config))
- if not __measurethread__.isActive():
+ if not __measurethread__.is_alive():
+ __measurethread__ = measureThread()
__measurethread__.start()
__listlock__.release()
print('Prepare thread stop')
class measureThread(Thread):
+ global __preparethread__
+ global __measurethread__
def __init__(self, name='measure'):
Thread.__init__(self, name=name)
def run(self):
@@ -80,7 +85,8 @@ class measureThread(Thread):
while not __terminate__ and len(__conflist__) > 0:
img, config = __conflist__.pop()
__listlock__.release()
- if not __preparethread__.isActive():
+ if not __preparethread__.is_alive():
+ __preparethread__ = prepareThread()
__preparethread__.start()
measure(img, config)
__listlock__.acquire()