|
Class: Singleton
Object
|
+--Singleton
|
+--Dolphin::DeafObject
- Package:
- stx:libbasic2
- Category:
- System-Support
- Version:
- rev:
1.10
date: 2021/03/09 09:40:10
- user: cg
- file: Singleton.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
Subclasses of Singleton have only a single instance.
The instance creation methods ensure that there is only one instance.
Singletons that would have inherited from Object could inherit from
Singleton. For Singletons that do not inherit from Object,
you have to copy the Singleton's code to your class.
[class instance variables:]
theOnlyInstance Object The only instance of this class
[class variables:]
Lock RecursionLock A global lock to protect against races during instance creation
copyrightCOPYRIGHT (c) 2006 by eXept Software AG
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.
accessing
-
singletonLock
-
can be used by other classes that are not subclasses of Singleton
-
theOnlyInstance
-
must check again because of possible raise
initialization
-
initialize
-
(comment from inherited method)
called only once - initialize signals
instance creation
-
basicNew
-
allocate a singleton in a thread-safe way.
Do lazy locking here
-
basicNew: anInteger
-
allocate a singleton in a thread-safe way.
Do lazy locking here
-
new
-
allocate a singleton in a thread-safe way.
Do lazy locking here
-
new: count
-
allocate a singleton in a thread-safe way.
Do lazy locking here
-
releaseInstance
-
release the singleton's instance.
Use only for debugging!
|