aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-08-26 19:09:10 +0200
committerKarel Kočí <cynerd@email.cz>2015-08-26 19:11:18 +0200
commit07fdad8a1834a84a476faf0b9ca9b817263cf3ec (patch)
tree4f0b76dd4ac8316ec63946191bacc1f31a1545f3 /scripts
parent5f51bdac574ed3c7ff8592129112f205c2c135d7 (diff)
downloadlinux-conf-perf-07fdad8a1834a84a476faf0b9ca9b817263cf3ec.tar.gz
linux-conf-perf-07fdad8a1834a84a476faf0b9ca9b817263cf3ec.tar.bz2
linux-conf-perf-07fdad8a1834a84a476faf0b9ca9b817263cf3ec.zip
Fix multithread locking and terminating
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/loop.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/loop.py b/scripts/loop.py
index ad87f18..f4a37a2 100755
--- a/scripts/loop.py
+++ b/scripts/loop.py
@@ -56,14 +56,14 @@ class prepareThread(Thread):
def __init__(self, name='prepare'):
Thread.__init__(self, name=name)
def run(self):
- __listlock__.aquire()
+ __listlock__.acquire()
while not __terminate__ and len(__conflist__) <= conf.multithread_buffer:
__listlock__.release()
try:
img, config = prepare()
except exceptions.NoApplicableConfiguration:
return
- __listlock__.aquire()
+ __listlock__.acquire()
__conflist__.add((img, config))
if not __measurethread__.isActive():
__measurethread__.start()
@@ -73,21 +73,23 @@ class measureThread(Thread):
def __init__(self, name='measure'):
Thread.__init__(self, name=name)
def run(self):
- __listlock__.aquire()
+ __listlock__.acquire()
while not __terminate__ and len(__conflist__) > 0:
img, config = __conflist__.pop()
__listlock__.release()
if not __preparethread__.isActive():
__preparethread__.start()
measure(img, config)
- __listlock__.aquire()
+ __listlock__.acquire()
__listlock__.release()
__preparethread__ = prepareThread()
__measurethread__ = measureThread()
# Start and sigterm handler #
+__terminate__ = False
def sigterm_handler(_signo, _stack_frame):
+ global __terminate__
__terminate__ = True
# Main loop and single thread #