My favorites | Sign in
Project Home Downloads Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 108 attachment: TestWithCFThread.cfc (1.0 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<cfcomponent output="false" extends="mxunit.framework.TestCase">

<cffunction name="thread_10Factorial">

<cfset var i = "">
<cfset results = structnew()>

<cfset assertTrue(true,"sanity check failed")>

<cfloop from="1" to="10" index="i">
<cfthread action="run" name="#i#" threadID="#i#">
<cfset thread.result = 1>
<cfloop from="1" to="10" index="thread.j">
<cfset thread.result = thread.result * thread.j>
</cfloop>
<cfset results[attributes.threadID] = thread.result>
</cfthread>
</cfloop>

<cfloop from="1" to="10" index="i">
<cfthread action="join" name="#i#"/>
<cfset assertEquals(results[i],3628800,"Did not compute 10!")>
</cfloop>
</cffunction>

</cfcomponent>
Powered by Google Project Hosting