Greg's Blog

helping me remember what I figure out

Race Conditions

| Comments

Again an enlightening thread, this time on the BD mailing list discussing race conditions or put more simply when to lock. Spike put up an example of how a race condition might occur: [code] [/code] While on say the first request the <cfset> is taking place another request might come in checking if application.initialised is true before the set has completed thus leading the second request to believe that it’s not initialised and hence needs to be. This is known as a race condition. To circumvent this you would <cflock> (with a type exclusive) the <cfset>, effectively locking access completely to application.initialised until it’s completed the request. [code] [/code] Thanks Spike!