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:19:09 +0200
commit88bce0d3359f570388c21e04c0556e6736afc28b (patch)
tree1de8b7d59a89fef366feda0bbf052e7f1c533c14 /scripts
parent96825e484149a44d17e2f2330c8fe2ee4563259c (diff)
downloadlinux-conf-perf-88bce0d3359f570388c21e04c0556e6736afc28b.tar.gz
linux-conf-perf-88bce0d3359f570388c21e04c0556e6736afc28b.tar.bz2
linux-conf-perf-88bce0d3359f570388c21e04c0556e6736afc28b.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()