D
Daniel Nugent
Mental, could I perchance persuade you to add an optional parameter to
the Future initializer that accepts a block to be run inside the
rescue clause of the Future's thread?
The situation I am specifically thinking of is this:
I have a number of objects that will want the value resulting from the
Future. I know all of these objects WILL need to access that value.=20
Because the computation in the Future is very expensive, I would like
to raise exceptions on those objects as soon as the thread is caught
so that they can begin handling the error as soon as possible.
So, at the time of the exception, I can lock down the current
subscribers list and then fire off the exception to each of them.=20
Something like this:
future(lambda{|exception| lock.synchronize{subscribers.each{|s|
s.raise(exception)}}}){holy_crap_long_execution}
the Future initializer that accepts a block to be run inside the
rescue clause of the Future's thread?
The situation I am specifically thinking of is this:
I have a number of objects that will want the value resulting from the
Future. I know all of these objects WILL need to access that value.=20
Because the computation in the Future is very expensive, I would like
to raise exceptions on those objects as soon as the thread is caught
so that they can begin handling the error as soon as possible.
So, at the time of the exception, I can lock down the current
subscribers list and then fire off the exception to each of them.=20
Something like this:
future(lambda{|exception| lock.synchronize{subscribers.each{|s|
s.raise(exception)}}}){holy_crap_long_execution}