Mercurial > bitten > bitten-test
changeset 665:177d52932d03
0.6dev: Simpler threading implementation in the queue populate race-condition test.
author | osimons |
---|---|
date | Thu, 03 Sep 2009 11:03:25 +0000 |
parents | 1683869bc665 |
children | 3c1c52f5e8ad |
files | bitten/tests/queue.py |
diffstat | 1 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/tests/queue.py +++ b/bitten/tests/queue.py @@ -285,16 +285,12 @@ platform2 = TargetPlatform(self.env, config='test', name='P2') platform2.insert() - class BuildPopulator(threading.Thread): - def __init__(self, env): - self.env = env - threading.Thread.__init__(self) - def run(self): - queue = BuildQueue(self.env, build_all=True) - queue.populate() - - thread1 = BuildPopulator(self.env) - thread2 = BuildPopulator(self.env) + def build_populator(): + queue = BuildQueue(self.env, build_all=True) + queue.populate() + + thread1 = threading.Thread(target=build_populator) + thread2 = threading.Thread(target=build_populator) thread1.start(); thread2.start() thread1.join(); thread2.join()