[Bug] CFTHREAD status is not be updated correctly when sleep() and join action

I’ve just created another ticket : https://luceeserver.atlassian.net/browse/LDEV-382

If you wanna test, below is my snippet (syntax highlight breaks when I use
cfscript syntax) :

<cflog text="=== #thread.name# starts ===">
<cfset sleep(t1ProcessingDuration)>
<cflog text="=== #thread.name# ends ==="></cfthread>
	<!--- One can remove this sleep to check thread status only for action="join" --->
	<cfif t2ProcessingBeforeJoin GT 0>
		<cfset sleep(t2ProcessingBeforeJoin)>
	<cfthread action="join" name="T1" timeout="#t2JoinDuration#"/>
	<cflog text="=== #thread.name# join passed successfully ===">
	<cfcatch type="Any">
		<cflog type="error" text=">>> T2 error: #cfcatch.message#">
<cfset isStateValidInCF=(compareNoCase(cfthread.T2.status,"WAITING") EQ 0)>
<!--- Just need to know if Java thread goes waiting at least once --->
<cfif NOT isStateValidInJava>
	<cfset isStateValidInJava=(compareNoCase(t2.getState().valueOf(t2.getState()),t2.State.TIMED_WAITING) EQ 0)>
<cfif isStateValidInCF EQ TRUE>
	<!--- Bug: This seems to never happen i.e T2 is never waiting... --->
<cfif timeSpentWaiting GT t1ProcessingDuration>
	<cfset sleep(refreshT1StateInterval)>
	<!--- You can use getTickCount() instead if you want a more precise duration value --->
	<cfset timeSpentWaiting=timeSpentWaiting+refreshT1StateInterval>
</cfif></cfloop><!---Because T2 is waiting with action="join" after t2ProcessingBeforeJoin (lower than t1ProcessingDuration).Then both isStateValidInCF and isStateValidInJava are expected to be TRUE. But isStateValidInCF is still FALSE.---><cfoutput>
After #timeSpentWaiting#ms : isStateValidInCF is #isStateValidInCF# and isStateValidInJava is #isStateValidInJava#<br></cfoutput>