.
authorclaus
Tue, 02 May 1995 01:03:57 +0200
changeset 330 ae624fbef977
parent 329 f14fc5ac11b7
child 331 edaf12ba7eac
.
ImmutableArray.st
Project.st
RecursionLock.st
--- a/ImmutableArray.st	Mon May 01 23:40:01 1995 +0200
+++ b/ImmutableArray.st	Tue May 02 01:03:57 1995 +0200
@@ -37,7 +37,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.3 1995-02-22 01:16:48 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.4 1995-05-01 23:03:57 claus Exp $
 "
 !
 
@@ -69,7 +69,7 @@
 creator 
     "find the method that contains me"
 
-    Method allDerivedInstances do:[:aMethod |
+    Method allSubInstances do:[:aMethod |
 	|lits|
 
 	lits := aMethod literals.
--- a/Project.st	Mon May 01 23:40:01 1995 +0200
+++ b/Project.st	Tue May 02 01:03:57 1995 +0200
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Project.st,v 1.15 1995-03-25 22:10:09 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Project.st,v 1.16 1995-05-01 23:02:41 claus Exp $
 '!
 
 !Project class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Project.st,v 1.15 1995-03-25 22:10:09 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Project.st,v 1.16 1995-05-01 23:02:41 claus Exp $
 "
 !
 
@@ -160,7 +160,7 @@
 !
 
 views
-    ^ views
+    ^ views asArray
 !
 
 classes
@@ -186,7 +186,7 @@
 !
 
 views:aSetOfViews
-    views := aSetOfViews
+    views := WeakIdentitySet withAll:aSetOfViews
 !
 
 changeSet:aChangeSet
@@ -243,7 +243,7 @@
 !Project methodsFor:'initialization'!
 
 initialize
-    views := (OrderedCollection new).
+    views := WeakIdentitySet new.
     name := 'new Project-' , NextSequential printString.
     NextSequential := NextSequential + 1.
     packageName := 'private'.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RecursionLock.st	Tue May 02 01:03:57 1995 +0200
@@ -0,0 +1,99 @@
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+
+'From Smalltalk/X, Version:2.10.5 on 28-apr-1995 at 12:37:45 pm'!
+
+Object subclass:#RecursionLock
+	 instanceVariableNames:'process sema'
+	 classVariableNames:''
+	 poolDictionaries:''
+	 category:'Kernel-Processes'
+!
+
+!RecursionLock class methodsFor:'documentation'!
+
+documentation
+"
+    like a Semaphore for mutual exclusion, but avoids the deadlock
+    if a critical region is reentered by the same process again.
+
+    example:
+
+        |lock|
+
+        lock := RecursionLock new.
+        lock critical:[
+            Transcript showCr:'in lock ...'.
+            lock critical:[
+                Transcript showCr:'again ...'
+            ]
+        ]
+"
+
+!
+
+copyright
+"
+ COPYRIGHT (c) 1995 by Claus Gittinger
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+
+!
+
+version 
+"
+$Header: /cvs/stx/stx/libbasic/RecursionLock.st,v 1.1 1995-05-01 23:03:08 claus Exp $
+"
+! !
+
+!RecursionLock class methodsFor:'instance creation'!
+
+new
+    ^ self basicNew initialize
+
+! !
+
+!RecursionLock methodsFor:'wait & signal'!
+
+critical:aBlock
+    "evaluate aBlock as a critical region, but do not block,
+     if this lock is already held by the current process."
+
+    |active|
+
+    active := Processor activeProcess.
+    process == active ifTrue:[
+        aBlock value
+    ] ifFalse:[
+        process := active.
+        [
+            sema critical:aBlock
+        ] valueNowOrOnUnwindDo:[
+            process := nil
+        ]
+    ].
+! !
+
+!RecursionLock methodsFor:'private initialization'!
+
+initialize
+    sema := Semaphore forMutualExclusion
+! !
+