hooks for change-file-locking. Experimental
authorClaus Gittinger <cg@exept.de>
Sun, 05 Nov 1995 17:20:14 +0100
changeset 488 1677ee52d630
parent 487 898ed6e7391c
child 489 45722487c0f6
hooks for change-file-locking. Experimental
Class.st
--- a/Class.st	Sun Nov 05 15:24:50 1995 +0100
+++ b/Class.st	Sun Nov 05 17:20:14 1995 +0100
@@ -15,7 +15,7 @@
 ClassDescription subclass:#Class
 	 instanceVariableNames:'classvars comment subclasses classFilename package revision
 		history'
-	 classVariableNames:'UpdatingChanges FileOutErrorSignal CatchMethodRedefinitions
+	 classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal CatchMethodRedefinitions
 		MethodRedefinitionSignal UpdateChangeFileQuerySignal'
 	 poolDictionaries:''
 	 category:'Kernel-Classes'
@@ -25,7 +25,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Class.st,v 1.65 1995-11-04 20:54:39 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Class.st,v 1.66 1995-11-05 16:20:14 cg Exp $
 "!
 
 documentation
@@ -66,6 +66,11 @@
 					(except during startup and when filing in, this flag
 					 is usually true)
 
+	LockChangesFile <Boolean>       if true, the change file is locked for updates.
+					Required when multiple users operate on a common
+					change file.
+					This is an experimental new feature, being evaluated.
+
 	UpdateChangeFileQuerySignal     used as an upQuery from the change management.
 					Whenever a changeRecord is to be written,
 					this signal is raised and a handler (if present)
@@ -115,6 +120,7 @@
      to avoid putting too much junk into the changes-file."
      
     UpdatingChanges := true.
+    LockChangesFile := false.
     CatchMethodRedefinitions := true.
 
     FileOutErrorSignal isNil ifTrue:[
@@ -173,6 +179,16 @@
     ^ prev
 !
 
+lockChangesFile:aBoolean
+    "turn on/off change-file-locking. Return the previous value of the flag."
+
+    |prev|
+
+    prev := LockChangesFile.
+    LockChangesFile := aBoolean.
+    ^ prev
+!
+
 catchMethodRedefinitions:aBoolean
     "turn on/off redefinition catching. Return the prior value of the flag."
 
@@ -189,6 +205,12 @@
     ^ UpdatingChanges
 !
 
+lockChangesFile
+    "return true, if the change file is locked during update"
+
+    ^ LockChangesFile
+!
+
 catchMethodRedefinitions
     "return the redefinition catching flag."
 
@@ -1042,13 +1064,19 @@
 changesStream
     "return a Stream for the writing changes file - or nil if no update is wanted"
 
-    |aStream fileName|
+    |streamType aStream fileName|
 
     (UpdateChangeFileQuerySignal raise) ifTrue:[
 	fileName := ObjectMemory nameForChanges.
-	aStream := FileStream oldFileNamed:fileName.
+        
+	LockChangesFile ifTrue:[
+	    streamType := LockedFileStream. 
+	] ifFalse:[
+	    streamType := FileStream.
+	].
+	aStream := streamType oldFileNamed:fileName.
 	aStream isNil ifTrue:[
-	    aStream := FileStream newFileNamed:fileName.
+	    aStream := streamType newFileNamed:fileName.
 	    aStream isNil ifTrue:[
 		self warn:'cannot create/update the changes file'.
 		^ nil