Skip to content

Instantly share code, notes, and snippets.

@guyboertje
Created November 20, 2015 09:21
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 guyboertje/c272ce09d4927d5b455f to your computer and use it in GitHub Desktop.
Save guyboertje/c272ce09d4927d5b455f to your computer and use it in GitHub Desktop.
def enqueue(event)
q1 = SizedQueue.new(1)
tt = Thread.new(q1) do |q|
sleep 5
q.push 42
end
wt = Thread.new(q1) do |q|
@otherqueue.push event
q.push 43
end
result = q1.pop
end
# main thread
enqueue(Event.new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment