[ZODB-Dev] How to update an object in a multithreading application?
Alan Runyan
runyaga at gmail.com
Mon Mar 19 17:57:53 UTC 2012
> I am updating an item in a separated thread but when it finishes the new
> value is not updated in the same object in the main thread.
You need to call sync() on the connection object to see changes from
another thread.
http://zodb.readthedocs.org/en/latest/api.html#connections
> In the example below root['counter'] starts in 0, is incremented in the new
> thread but it remains in 0 in the main thread.
if your increment a counter its best the counter be of type, BTrees.Length
cheers,
alan
More information about the ZODB-Dev
mailing list