-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect access to the SymbolTable with a semaphore. Thanks Andrés.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
CoreUpdates/6883-accessProtect-SymbolTable-JuanVuletich-2024Dec01-15h33m-jmv.001.cs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'From Cuis7.1 [latest update: #6882] on 1 December 2024 at 3:52:45 pm'! | ||
!classDefinition: #Symbol category: #'Kernel-Text'! | ||
String variableByteSubclass: #Symbol | ||
instanceVariableNames: '' | ||
classVariableNames: 'Symbols AccessProtect ' | ||
poolDictionaries: '' | ||
category: 'Kernel-Text'! | ||
|
||
!Symbol class methodsFor: 'access' stamp: 'jmv 12/1/2024 15:47:52'! | ||
accessProtect | ||
AccessProtect ifNil: [ | ||
AccessProtect := Semaphore forMutualExclusion ]. | ||
^AccessProtect! ! | ||
|
||
!Symbol class methodsFor: 'access' stamp: 'jmv 12/1/2024 15:51:35'! | ||
symbolCount | ||
|
||
^self accessProtect critical: [ Symbols size ].! ! | ||
|
||
|
||
!Symbol class methodsFor: 'instance creation' stamp: 'jmv 12/1/2024 15:49:23'! | ||
intern: aStringOrSymbol | ||
|
||
^self accessProtect critical: [ | ||
Symbols intern: aStringOrSymbol ].! ! | ||
|
||
!Symbol class methodsFor: 'instance creation' stamp: 'jmv 12/1/2024 15:49:35'! | ||
lookup: aStringOrSymbol | ||
|
||
^self accessProtect critical: [ | ||
Symbols lookup: aStringOrSymbol ].! ! | ||
|
||
!Symbol class methodsFor: 'private' stamp: 'jmv 12/1/2024 15:49:44'! | ||
rehash | ||
"Rebuild the hash table" | ||
"Symbol rehash" | ||
|
||
|
||
self accessProtect critical: [ | ||
Symbols := SymbolSet new. | ||
Symbols rehash ].! ! | ||
|
||
!classDefinition: #Symbol category: #'Kernel-Text'! | ||
String variableByteSubclass: #Symbol | ||
instanceVariableNames: '' | ||
classVariableNames: 'AccessProtect Symbols' | ||
poolDictionaries: '' | ||
category: 'Kernel-Text'! |