Issue 171: temporarily backed out changeset a68e1e09f73a
...as it causes VM to crash in `Smalltalk >> #keys`.
See https://swing.fit.cvut.cz/projects/stx-jv/ticket/171
--- a/RecursionLock.st Mon Jul 31 21:56:39 2017 +0100
+++ b/RecursionLock.st Tue Aug 08 16:46:35 2017 +0100
@@ -41,7 +41,7 @@
"
like a Semaphore for mutual exclusion, but avoids the deadlock
if a critical region is reentered by the same process again.
- I.e. allows reentering the critical region IFF the current process
+ I.e. allows reentering the critical region IFF the current process
is the one which did the original locking.
WARNING:
@@ -96,7 +96,7 @@
forMutualExclusion
"same as new, for easy exchangability with regular mutual-exclusion Semaphores."
- ^ self new
+ ^ self new
!
new
@@ -167,13 +167,13 @@
!
wouldBlock
- "Check if the resource represented by the receiver is
+ "Check if the resource represented by the receiver is
already in use by another process.
Attention: if asked without some global lock (blockedInterrupts),
the returned value may be outdated right away."
|p|
-
+
^ (p := process) notNil and:[Processor activeProcess ~~ p and:[p isDead not]]
! !
@@ -182,6 +182,8 @@
signal
|wasBlocked|
+ Logger warn: 'RecursionLock >> #signal called'.
+
process ~~ Processor activeProcess ifTrue:[
self error:'RecursionLock - signaling process doesn''t own the lock'.
].
@@ -224,7 +226,7 @@
wasBlocked := OperatingSystem blockInterrupts.
[
(process notNil and:[process isDead]) ifTrue:[
- process := nil.
+ process := nil.
'RecursionLock [warning]: cleanup lock from dead process' infoPrintCR.
sema signal.
].
@@ -257,7 +259,7 @@
!
critical:aBlock timeoutMs:timeoutMs ifBlocking:blockingBlock
- "like critical:, but do not block if the lock cannot be acquired
+ "like critical:, but do not block if the lock cannot be acquired
within timeoutMs milliseconds.
Instead, return the value of blockingBlock."
@@ -287,7 +289,7 @@
wasBlocked := OperatingSystem blockInterrupts.
[
(process notNil and:[process isDead]) ifTrue:[
- process := nil.
+ process := nil.
'RecursionLock [warning]: cleanup lock from dead process' infoPrintCR.
sema signal.
].
@@ -327,6 +329,8 @@
|active wasBlocked|
+ Logger warn: 'RecursionLock >> #wait called'.
+
active := Processor activeProcess.
process == active ifTrue:[
"I have already got the lock"
@@ -336,7 +340,7 @@
wasBlocked := OperatingSystem blockInterrupts.
(process notNil and:[process isDead]) ifTrue:[
"/ a process which had the lock died without a chance to release it (i.e. it was hard terminated)
- process := nil.
+ process := nil.
'RecursionLock [info]: cleanup leftover lock from dead process' infoPrintCR.
sema signal.
].
--- a/Smalltalk.st Mon Jul 31 21:56:39 2017 +0100
+++ b/Smalltalk.st Tue Aug 08 16:46:35 2017 +0100
@@ -1253,7 +1253,7 @@
|keys|
- keys := IdentitySet new: self size.
+ keys := IdentitySet new.
self keysDo:[:k | keys add:k].
^ keys
!
@@ -1290,7 +1290,7 @@
|values|
- values := OrderedCollection new: self size.
+ values := OrderedCollection new.
self do:[:v | values add:v].
^ values
@@ -3691,17 +3691,6 @@
"Modified: / 14.6.1998 / 15:54:03 / cg"
!
-size
- "Return the number of globals"
-
-%{
- return __MKINT( __GLOBALS_SIZE() ) ;
-%}.
- self primitiveFailed.
-
- "Created: / 03-07-2017 / 21:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
someImplementorOf:aSelector
"return any class, which implement the given selector. Nil if there is none.
(useful to search, if there is one at all)"