aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-08-13 11:19:09 +0200
committerKarel Kočí <cynerd@email.cz>2015-08-13 11:20:55 +0200
commitfb3c8e339fb3896753f7130b8f8e34be8d89ae2e (patch)
tree193066ce901ff07fa08e819390cb209c1bc6a837 /scripts
parent57b76964ed0397cb48458c1a55acaeb19c287d45 (diff)
downloadlinux-conf-perf-fb3c8e339fb3896753f7130b8f8e34be8d89ae2e.tar.gz
linux-conf-perf-fb3c8e339fb3896753f7130b8f8e34be8d89ae2e.tar.bz2
linux-conf-perf-fb3c8e339fb3896753f7130b8f8e34be8d89ae2e.zip
Fix thread cooperation in loop
Measure function requires img and config as atributes. But only config was provided.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/loop.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/loop.py b/scripts/loop.py
index aecda39..9cc8ddb 100755
--- a/scripts/loop.py
+++ b/scripts/loop.py
@@ -58,7 +58,7 @@ class mainThread(Thread):
measure(img, config)
# Multithread section #
-__conflist__ = []
+__conflist__ = set()
__listlock__ = Lock()
class prepareThread(Thread):
@@ -69,11 +69,11 @@ class prepareThread(Thread):
while not __terminate__ and len(__conflist__) <= conf.multithread_buffer:
__listlock__.release()
try:
- config = prepare()
+ img, config = prepare()
except exceptions.NoApplicableConfiguration:
return
__listlock__.aquire()
- __conflist__.append(config)
+ __conflist__.add((img, config))
if not __measurethread__.isActive():
__measurethread__.start()
__listlock__.release()
@@ -84,12 +84,11 @@ class measureThread(Thread):
def run(self):
__listlock__.aquire()
while not __terminate__ and len(__conflist__) > 0:
- config = __conflist__[0]
- del __conflist__[0]
+ img, config = __conflist__.pop()
__listlock__.release()
if not __preparethread__.isActive():
__preparethread__.start()
- measure(config)
+ measure(img, config)
__listlock__.aquire()
__listlock__.release()