I started another thread with a question about some code in the docs
that used a sleep function and a status check to delay a thread's start,
but the code in the waiting thread was in <cfscript> blocks and the
processing was supposed to occur in the block.  I haven't used cfscript
so I asked if it was possible to just have the block run and then
let the rest of the thread use regular CFML, but my data didn't get
processed by that particular thread, but the data was processed by
all other threads in the .cfm.

Here's the question as I posted it:

I'm trying to set up a way to check the status of threads
and implement a sleep function that loops and delays a following
thread's initialization until the status of the first thread is "Completed".

I found an example in the CF8 docs using a sleep timer this is
placed just inside the opening <cfthread...> tag of the cfthread that needs to 
wait.

    <cfscript>
        thread.sleepTimes=0;
        thread.initialized=false;
        while ((2_hmls_offices.Status != "COMPLETED") && (2_hmls_offices.Status 
                != "TERMINATED")) {
            sleep(2000);
            thread.sleeptimes++;
        }
        // Only do the post-initilization code if 2_hmls_offices is complete.
        If (threadA.Status == "COMPLETED") {
            thread.initialized=true; 
            // Post-initialization code would go here.
        }
    </cfscript>

I understand what's happening inside the cfscript, but I'd like to continue
the processing *outside* the cfscript tag and use regular CFML, not cfscript
for the thread.

This example states, in the last line "//Post-initialization code would go 
here".

Can I just use the cfscript as is and follow the cfscript block with my
cfqueries, etc., or would all my thread processing have to occur within the
cfscript block?  Is there a way to break out of the cfscript block once
the status of the first thread, "2_hmls_offices", is "Completed" and go 
on to process regular CFML code?

Thanks,

Rick




> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 29, 2008 2:08 PM
> To: CF-Talk
> Subject: Re: cfthread running condition?
> 
> Rick Faircloth wrote:
> > Is there a way to make the start of one thread
> > conditional upon the ending of a previous thread?
> It should be possible using the thread.status feature.  You would create
> a thread then watch the status until it reports "completed" then start
> the next thread.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311806
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to