![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a numeric field. Users will modify it by adding a value to it. But I'm a little concerned about the unlikely event where two users are incrementing it at the same time. Unless there is some sort of lock between the time the old value is read and the sum of the two values is written, one change could override another. Any suggestions? Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com |
#3
| |||
| |||
|
|
I have a numeric field. Users will modify it by adding a value to it. But I'm a little concerned about the unlikely event where two users are incrementing it at the same time. Unless there is some sort of lock between the time the old value is read and the sum of the two values is written, one change could override another. Any suggestions? Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com |
#4
| |||
| |||
|
|
Jonathan, I don't understand how this particular example would need to be handled any differently than your normal concurrency handling. Kerry Moorman "Jonathan Wood" wrote: I have a numeric field. Users will modify it by adding a value to it. But I'm a little concerned about the unlikely event where two users are incrementing it at the same time. Unless there is some sort of lock between the time the old value is read and the sum of the two values is written, one change could override another. Any suggestions? Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com |
#5
| |||
| |||
|
|
Assuming you are using some sort of database, mark the transaction as serializable and include a WHERE clause with the old value. "Jonathan Wood" <jwood (AT) softcircuits (DOT) com> wrote in message news:%23Amxi2kTIHA.1168 (AT) TK2MSFTNGP02 (DOT) phx.gbl... I have a numeric field. Users will modify it by adding a value to it. But I'm a little concerned about the unlikely event where two users are incrementing it at the same time. Unless there is some sort of lock between the time the old value is read and the sum of the two values is written, one change could override another. Any suggestions? Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com |
#6
| |||
| |||
|
|
If I want to set a field to a specific value, I can just set it. If it overrides another update, that's fine because someone set the value after someone else. On the other hand, if I want to increment a value, say, 10, it's possible that two users read the old value, the first one writes an 11 and then the second one writes an 11. In this case, the second update was not an increment, as expected. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com "Kerry Moorman" <KerryMoorman (AT) discussions (DOT) microsoft.com> wrote in message news:EF5713A9-77FC-48F3-8A18-BDDDCEF940AF (AT) microsoft (DOT) com... Jonathan, I don't understand how this particular example would need to be handled any differently than your normal concurrency handling. Kerry Moorman "Jonathan Wood" wrote: I have a numeric field. Users will modify it by adding a value to it. But I'm a little concerned about the unlikely event where two users are incrementing it at the same time. Unless there is some sort of lock between the time the old value is read and the sum of the two values is written, one change could override another. Any suggestions? Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com |
#7
| |||
| |||
|
|
So you are saying that you generally handle concurrency with the "last in wins" strategy? |
#8
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |