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

Hi Tim,

I'd do one of two things......

Write a stored procedure (if the database supports it) and update the
totals through that mechanism (you would still need some sort of locking
in there to prevent race).

OR

Create an Application scope variable for the vote object (use a struct
with the objectID as the key) and lock that while you update the vote
total.  (e.g. Applications.votes[objectID]).  There is still an issue
with this though - and that is another vote getting the WRONG total
(pending an update from another voter).  So maybe you should look at
loading the stObj into the abovementioned application variable and
always updating the total there?  It's a tricky one.


No point in locking stObj because it is local to the request scope.


Regards,
Gary





---
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