Learning ColdFusion 8: CFThread's VARIABLES Scope Update (Thanks Dan G. Switzer, II)

<!--- Set a message into the VARIABLES scope. --->
<cfset VARIABLES.Message = "From Parent Page" />
 
 
<!--- Launch a child thread. --->
<cfthread
	action="run"
	name="ThreadOne">
 
	<!---
		Store a message into this thread's VARIABLES
		scope. This is NOT the page's VARIABLES scope;
		threads have their own version.
	--->
	<cfset VARIABLES.Message = "From Thread One!" />
 
</cfthread>
 
 
<!---
	Let's wait for thread one to finish so that we know
	exactly where all of our values are coming from.
	Remember, these threads are asyncronous. In fact, they
	might not even execute in the same order in which they
	were defined.
--->
<cfthread
	action="join"
	name="ThreadOne"
	/>
 
 
<!--- Launch a child thread. --->
<cfthread
	action="run"
	name="ThreadTwo">
 
	<!---
		Get the message from the VARIABLES scope
		and store it into this thread's publically
		accessible THREAD scope.
	--->
	<cfset THREAD.Message = VARIABLES.Message />
 
</cfthread>
 
 
<!---
	Join the second thread to the current page process.
	After this, all our child threads will have finished
	executing (and in the same order as they were declared).
--->
<cfthread
	action="join"
	name="ThreadTwo"
	/>
 
 
<!--- Output the message stored into thread two. --->
Thread Two: #ThreadTwo.Message#<br />
 
<!--- Output the message stored in the parent. --->
Parent: #VARIABLES.Message#

For Cut-and-Paste