Cfthread does have a terminate action. https://wikidocs.adobe.com/wiki/display/coldfusionen/cfthread
You could do some sort of loop that checks the status of the threads every second or so, pausing with the sleep function. When you hit your exception, loop over the threads to terminate those threads requiring it. Alternately, your thread join can have a timeout. You could put a maximum wait time. Then loop the threads and terminate those not completed and throw an error. Byron Mann Lead Engineer & Architect HostMySite.com On Jul 23, 2014 6:24 PM, "Yuliang Ruan" <yuliangr...@hotmail.com> wrote: > > 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:358994 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm