RE: [ZODB-Dev] Deferred notifing from one thread to another.

2005-12-09 Thread Tim Peters
[Victor Safronovich]
 ...
 Of course i may write time.sleep( SLEEP_CONSTANT ) before
 app._p_jar.sync(), but is this a good solution?

I can't make time to understand your problem (sorry!), but I can make time
to tell you that a bare time.sleep() is almost never a good solution to
thread problems.  time.sleep() in a _loop_ can be reliable, provided you can
write code to recognize when what you're waiting for has happened; this
approach is called polling.

while what I'm waiting for hasn't happened:
time.sleep(WHATEVER)

For example, when you change a persistent object, its ._p_changed attribute
gets set to a true value.  When the change gets committed, ._p_changed is
reset to a false value.  So _perhaps_ (I'm not sure -- being sure would
require understanding all of your problem) you could poll waiting for some
specific object's _p_changed to become false.

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] Deferred notifing from one thread to another.

2005-12-09 Thread Dieter Maurer
Victor Safronovich wrote at 2005-12-9 14:33 +0500:
 ...
But when T2
still not commiting its transaction, dispatcher not see new element :(.

Any transaction will only see committed changes.

Only at transaction boundaries will a connection cache be updated
for modifications by other transactions.

-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev