On 08/03/14 16:02, Qi He wrote:
Hello,
When should use a lock on a dataset vs. a transaction? What about with
models? Are locks necessary then? Will there be inconsistencies when
dealing with persistent models when updating them from two separate threads?
Use transactions unless you want some special effect or other.
Transaction allow multiple readers AND a single writer at the same time.
Pure locking only give multiple readers OR a single writer.
And transaction are crash resistant.
If you want multiple threads inside one transaction, you then need to do
locking as well - the thread doing the .begin must be the one to do the
.commit./.end.
Andy