cfthread issues

76 views
Skip to first unread message

Hugh Rainey

unread,
Nov 30, 2016, 11:28:33 AM11/30/16
to Lucee
I'm wondering if anyone is having the same issues I'm having and if they are, have they been able to overcome them.

I've been trying to utilize cfthread in an update page that runs on my system every Monday.  I'm updating a database within the thread and only just recently realized that there is an error within the thread.  I actually don't need any help with regards to figuring out the issue, but while I was working to find the solution I came across an inconsistency.  With ACF I can use code like the following.

cfthread action=run name=thread1 {
thread1.testvar = "this is a test of the emergency system"
thread.testvar2 = "this is another test"
writeoutput(testvar)
writeoutput(testvar2)
/cfthread

writeoutput(thread1.testvar & "br")
writeoutput(thread1.testvar2)

The above ACF code outputs: "this is a test of the emergency system" and "this is another test".  

On lucee I get nothing.  I've tried testing the length of thread1.testvar using thread1.testvar.len() but it reads 0. I've also tried using thread1.output.len() and just thread1.output to see if I get something. Nada, bupkiss.  Weird thing is if I dump( thread1 ) the values for testvar and testvar2 show up.  It's only when I try to access the info directly that it doesn't read it.

If anyone has an idea on how to fix this or if Lucee has a different way to access thread information please let me know.

Hugh


Zac Spitzer

unread,
Nov 30, 2016, 5:41:24 PM11/30/16
to lu...@googlegroups.com
which version are you running?

--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/4ee980d8-576c-41e6-a8a4-a29d662a5229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Zac Spitzer
+61 405 847 168

Joseph Gooch

unread,
Nov 30, 2016, 7:22:14 PM11/30/16
to lu...@googlegroups.com
Are you sure the thread has finished/written those variables by the time you're accessing them?

I'd add a cfthread action=join name=thread1 after your thread block and before your writeoutput.

-G

Hugh Rainey

unread,
Dec 1, 2016, 4:54:41 PM12/1/16
to Lucee
So I added the suggested thread action=join name=thread1 to my test code and still no bueno.  I also tried the following with no luck either.

<cfthread action="run" name="thread1" >
<cfset testvar = "This is a test of the emergency" >

<cfoutput>#testvar#</cfoutput>


</cfthread>

<cfthread action="sleep" duration="2000" />
<cfthread action="join" name="thread1"/>


<cfoutput>
Thread1 Value: #thread1.testvar# <br>
Thread1 output: #thread1.output#
</cfoutput>

Any thoughts?


On Wednesday, November 30, 2016 at 5:22:14 PM UTC-7, Joseph Gooch wrote:
Are you sure the thread has finished/written those variables by the time you're accessing them?

I'd add a cfthread action=join name=thread1 after your thread block and before your writeoutput.

-G
On Wed, Nov 30, 2016 at 11:28 AM, Hugh Rainey <hu...@fivetoad.com> wrote:
I'm wondering if anyone is having the same issues I'm having and if they are, have they been able to overcome them.

I've been trying to utilize cfthread in an update page that runs on my system every Monday.  I'm updating a database within the thread and only just recently realized that there is an error within the thread.  I actually don't need any help with regards to figuring out the issue, but while I was working to find the solution I came across an inconsistency.  With ACF I can use code like the following.

cfthread action=run name=thread1 {
thread1.testvar = "this is a test of the emergency system"
thread.testvar2 = "this is another test"
writeoutput(testvar)
writeoutput(testvar2)
/cfthread

writeoutput(thread1.testvar & "br")
writeoutput(thread1.testvar2)

The above ACF code outputs: "this is a test of the emergency system" and "this is another test".  

On lucee I get nothing.  I've tried testing the length of thread1.testvar using thread1.testvar.len() but it reads 0. I've also tried using thread1.output.len() and just thread1.output to see if I get something. Nada, bupkiss.  Weird thing is if I dump( thread1 ) the values for testvar and testvar2 show up.  It's only when I try to access the info directly that it doesn't read it.

If anyone has an idea on how to fix this or if Lucee has a different way to access thread information please let me know.

Hugh


--
Get 10% off of the regular price for this years CFCamp in Munich, Germany (Oct. 20th & 21st) with the Lucee discount code Lucee@cfcamp. 189€ instead of 210€. Visit https://ti.to/cfcamp/cfcamp-2016/discount/Lucee@cfcamp
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.

Hugh Rainey

unread,
Dec 1, 2016, 5:01:40 PM12/1/16
to Lucee
I added a cfdump to show the value are there, just not accessible directly through code.

<cfthread action="run" name="thread1" >
<cfset testvar = "This is a test of the emergency" >

<cfoutput>#testvar#</cfoutput>


</cfthread>
<cfthread action="sleep" duration="2000" />
<cfthread action="join" name="thread1"/>

<cfdump var="#thread1#">

<cfoutput>
Thread1 Value: #thread1.testvar# <br>
Thread1 output: #thread1.output#
</cfoutput>



Reply all
Reply to author
Forward
0 new messages