Skip to content

Instantly share code, notes, and snippets.

@ecin
Created June 14, 2009 08:12
Show Gist options
  • Save ecin/129601 to your computer and use it in GitHub Desktop.
Save ecin/129601 to your computer and use it in GitHub Desktop.
def consume(*types, &block)
filter_types(types)
@t.buf_consumer(buf_consumer)
begin
while(true) do
@t.sleep # the tricky little trickster
work = @t.work(probe_consumer, rec_consumer(block))
if (@done || work > 0)
break
end
end
ensure
@t.stop
@t.work(probe_consumer)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment