Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv28751
Modified Files:
CHANGES EditingContext.py
Log Message:
EditingContext.saveChangesInEditingContext(): now locks 'self' before
proceeding, so that two nested \class{EditingContext} which have the
same parent and are managed by two different threads can concurrently
save their changes to their parent without explictly locking it.
(this is logical since a EC is supposed to perform any of its
operations safely in a multi-threaded environment --given that it's
not shared between threads, obviously)
Index: CHANGES
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** CHANGES 10 Mar 2003 13:28:49 -0000 1.74
--- CHANGES 10 Mar 2003 16:36:08 -0000 1.75
***************
*** 8,13 ****
--------------------------------------------------------
* Added Modeling.utilities.EditingContextSessioning
!
* Changed _invalidatesObjectsWhenFinalized to
invalidatesObjectsWhenFinalized,
--- 8,21 ----
--------------------------------------------------------
+ * EditingContext.saveChangesInEditingContext(): now locks 'self' before
+ proceeding, so that two nested \class{EditingContext} which have the same
+ parent and are managed by two different threads can concurrently save
+ their changes to their parent without explictly locking it.
+ (this is logical since a EC is supposed to perform any of its
+ operations safely in a multi-threaded environment --given that it's
+ not shared between threads, obviously)
+
* Added Modeling.utilities.EditingContextSessioning
!
* Changed _invalidatesObjectsWhenFinalized to
invalidatesObjectsWhenFinalized,
Index: EditingContext.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/EditingContext.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** EditingContext.py 8 Mar 2003 16:23:15 -0000 1.18
--- EditingContext.py 10 Mar 2003 16:36:09 -0000 1.19
***************
*** 1189,1193 ****
changes.
-
Exceptions that can be raised:
--- 1189,1192 ----
***************
*** 1196,1200 ****
--- 1195,1215 ----
-
+ Note: this method also automatically locks 'self' before actually
+ saving the changes ; this makes it possible for two children of a
+ single EC to safely save their changes in two different threads
+ without having to worry about explicitly locking the parent EC.
+
See also: saveChanges(), processRecentChanges()
+ """
+ self.lock()
+ try:
+ self._savesChangesInEditingContext(self, anEditingContext)
+ finally:
+ self.unlock()
+
+ def _savesChangesInEditingContext(self, anEditingContext):
+ """
+ Private method called by saveChangesInEditingContext() after self has
+ been locked.
"""
if anEditingContext.parentObjectStore()!=self:
|