Skip to content

Instantly share code, notes, and snippets.

@saghul
Created November 1, 2012 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saghul/3997244 to your computer and use it in GitHub Desktop.
Save saghul/3997244 to your computer and use it in GitHub Desktop.
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