[Backgroundrb-devel] Defer multiple methods within the same worker to the thread pool?
Benjamin H. Bryant
iambenbryant at gmail.com
Sat Feb 2 23:56:49 EST 2008
Within a threaded worker, I would like to have multiple methods. Will
the following code work?
def method_1(args)
thread_pool.defer(args) do |args|
#work
end
end
def method_2(args)
thread_pool.defer(args) do |args|
#work
end
end
. . . or, should I have one "meta"-method and pass which sub-method
to perform via args?
def meta_method(args)
thread_pool.defer(args) do |args|
if args[:method] == "method_1"
#do work
end
if args[:method] == "method_2"
#do work
end
end
end
Thanks,
Ben
More information about the Backgroundrb-devel
mailing list