Skip to content

Instantly share code, notes, and snippets.

@ironfroggy
Created October 15, 2012 18:53
Show Gist options
  • Save ironfroggy/3894352 to your computer and use it in GitHub Desktop.
Save ironfroggy/3894352 to your computer and use it in GitHub Desktop.
class AsyncQueue(object):
def __init__(self):
self.q = []
self.ready = Future()
def push(self, value):
self.q.append(value)
yield self.ready(True)
def get(self):
while True:
while self.q:
yield self.q.pop()
yield self.ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment