Sometimes threading has a race condition on the last item.
HI I am using the threading for the report i am doing,But some times having race condition on the last item.Below is the code for reference.
Some one please help me on this thanks...
<cfloop from="1" to="5" index="tid">
<cfset threadlist = ListAppend(threadlist,"thread#tid#")>
<cfthread action="run" name="thread#tid#" dsn="#mydsn#">
<cfloop condition="#ListLen(mylist)#">
<cftry>
<cflock name="remove_item" timeout="5">
<cfset id = ListGetAt( mylist, 1) />
<cfset mylist = ListDeleteAt(mylist, 1) />
</cflock>
<cftry>
<!--- doing some database stuff like updating table --->
<cfcatch type="Any">
<!--- error message --->
</cfcatch>
</cftry>
<cfcatch type="any">
| <!--- error message ---> |
</cfcatch>
</cftry>
</cfloop>
</cfthread>
</cfloop>
<cfthread action="join" name="#threadlist#" timeout="0" />
