On Mon, 29 Oct 2001, Rick Osborne [Mojo] wrote:

> Date: Mon, 29 Oct 2001 18:05:35 -0500
> From: "Rick Osborne [Mojo]" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: CF-Talk <[EMAIL PROTECTED]>
> Subject: RE: Delaying template execution
> 
> Brian Ferrigno said:
> 
> > the code does work by creating a deadlock for the session
> 
> Deadlock, not race condition.  Quite right.  Too many Krispy Kremes for me.
> Point being, it blocks and *does not* spike your processor or anything lame
> like that.  The only downside is that it blocks all other locks for that
> session.  Of course, if you're using this for automated tasks, that's not
> really a problem.

You don't need to use scoped locks for this; named locks work just as
well.

<cfset lockname = CreateUUID()>
<cflock name="#lockname#" type="readonly" timeout="0">
        <cftry>
                <cflock
                 name="#lockname#"
                 type="exclusive"
                 timeout="#Attributes.timeout#"
                >
                </cflock>
                <cfcatch type="lock">
                </cfcatch>
        </cftry>
</cflock>

Cheers
Michiel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to