Skip to content

Instantly share code, notes, and snippets.

@jmhodges
Created June 16, 2009 23:11
Show Gist options
  • Save jmhodges/130970 to your computer and use it in GitHub Desktop.
Save jmhodges/130970 to your computer and use it in GitHub Desktop.
class ReverseGeoThread < Thread; end
class ListingThread < Thread; end
def run
cj = caller.join
if cj =~ /reverse_geo/
klass = ReverseGeoThread
elsif cj =~ /listings/
klass = ListingThread
else
klass = Thread
end
klass.new {
# a bunch of stuff
}
end
# old version
def run
cj = caller.join
if cj =~ /reverse_geo/
klass = ReverseGeoThread
elsif cj =~ /listings/
klass = ListingThread
end
Thread.new {
# a bunch of stuff
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment