diff options
Diffstat (limited to 'lib-python/2.7/test/test_hashlib.py')
-rw-r--r-- | lib-python/2.7/test/test_hashlib.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib-python/2.7/test/test_hashlib.py b/lib-python/2.7/test/test_hashlib.py index 471ebb4dd1..b8d6388fea 100644 --- a/lib-python/2.7/test/test_hashlib.py +++ b/lib-python/2.7/test/test_hashlib.py @@ -371,25 +371,25 @@ class HashLibTestCase(unittest.TestCase): data = smallest_data*200000 expected_hash = hashlib.sha1(data*num_threads).hexdigest() - def hash_in_chunks(chunk_size, event): + def hash_in_chunks(chunk_size): index = 0 while index < len(data): hasher.update(data[index:index+chunk_size]) index += chunk_size - event.set() - events = [] + threads = [] for threadnum in xrange(num_threads): chunk_size = len(data) // (10**threadnum) assert chunk_size > 0 assert chunk_size % len(smallest_data) == 0 - event = threading.Event() - events.append(event) - threading.Thread(target=hash_in_chunks, - args=(chunk_size, event)).start() - - for event in events: - event.wait() + thread = threading.Thread(target=hash_in_chunks, + args=(chunk_size,)) + threads.append(thread) + + for thread in threads: + thread.start() + for thread in threads: + thread.join() self.assertEqual(expected_hash, hasher.hexdigest()) |