Hey guys,

I have a custom type that is an extension of dmLink.
It has a method called "vote" with a single argument "bWasHelpful".

When called, the vote method creates a stObj with getData(), increments
its "votesTotal" numeric property, and commits to to the db with setData().

Here's the method code:

<cffunction name="vote" access="public" hint="Votes for whether this
link is helpful or note">
  <cfargument name="objectid" required="yes" type="UUID">
  <cfargument name="bWasHelpful" hint="Was the link helpful"
required="no" default="true" type="boolean">
  <cfargument name="voterDetails" hint="Details of the voter to be
included in the audit trail" required="yes" type="string">
  <cfset var stObj = this.getData(arguments.objectid)>
  <cfset ++stObj.votesTotal>
  <cfif arguments.bWasHelpful>
    <cfset ++stObj.votesHelpful>
  </cfif>
  <cfset this.setData( stProperties=stObj, bAudit=1,                 
auditNote=arguments.voteDetails)>
</cffunction>

How would I prevent the race condition that another request loses its
increment of the object's votesTotal property due to threading?

-- tim

www.toolmantim.com


--- You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to