Subject | Transactions |
---|---|
Author | Robert DiFalco |
Post date | 2003-07-30T17:11:49Z |
What if I've got two threads which perform the following actions on an
object. I say object because the "object" may be a record from several
joined tables:
thread 1
----------
- create transaction
- read object under transaction
- modify object
- write back object under transaction
- commit transaction
thread 2
----------
- create transaction
- remove object under transaction
- commit transaction
Now what if the order of events is as follows:
thread 1 - create transaction
thread 2 - create transaction
thread 1 - read object under transaction
thread 2 - remove object under transaction
thread 2 - commit transaction
thread 1 - modify object
thread 1 - write back object under transaction
thread 1 - commit transaction
Will thread 2 remove the object only to have it recreated by thread 1?
object. I say object because the "object" may be a record from several
joined tables:
thread 1
----------
- create transaction
- read object under transaction
- modify object
- write back object under transaction
- commit transaction
thread 2
----------
- create transaction
- remove object under transaction
- commit transaction
Now what if the order of events is as follows:
thread 1 - create transaction
thread 2 - create transaction
thread 1 - read object under transaction
thread 2 - remove object under transaction
thread 2 - commit transaction
thread 1 - modify object
thread 1 - write back object under transaction
thread 1 - commit transaction
Will thread 2 remove the object only to have it recreated by thread 1?