scenario is this.   main thread starts a pool of threads to do work.    the 
result of all threads are combined together to form a big result set and 
returned.
however, i'm envisioning that if 1 thread fails, the thread join is still 
waiting for the 9 other threads to complete before throwing an error.    is 
there a way that once one thread fails, immediately throw, ignoring the 9 other 
threads?

<cftry> 
<cfloop from="1" to="10" index="i"><cfthread name="t_#i#">  <cfset 
dofoo_that_can_fail_and_throw_error()></cfthread>
<cfthread action="join" name="t1,t2,t3,t4,t5,t6,t7,t8,t9,t10">
<cfloop list="t1,t2,t3,t4,t5,t6,t7,t8,t9,t10" index="i">  <cfif 
cfthread[i].status NEQ "COMPLETE">     <cfthrow type="fooFailed">  
</cfif></cfloop>
<cfcatch type="fooFailed">   <cfrethrow></cfcatch></cftry>c                     
                  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:358993
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to