Created
November 1, 2012 22:49
-
-
Save saghul/3997244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
from time import sleep | |
n_items = 1000 | |
queue = None | |
def put_stuff(): | |
for x in xrange(n_items): | |
queue.put_nowait("xxx") | |
def run_test(q, n): | |
global queue | |
queue = q | |
threads = [Thread(target=put_stuff) for x in xrange(n)] | |
[t.start() for t in threads] | |
count = n_items*n | |
while count > 0: | |
item = queue.get() | |
count -= 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment