--- a/Process.st Sat Dec 23 19:35:21 1995 +0100
+++ b/Process.st Sat Dec 23 19:50:22 1995 +0100
@@ -220,15 +220,103 @@
changePriority:aNumber
"same as priority:, but returns the old priority.
- (cannot do this in priority: for ST-80 compatibility)"
+ (cannot do this in #priority: for ST-80 compatibility)"
|oldPrio|
oldPrio := prio.
Processor changePriority:aNumber for:self.
^ oldPrio
+
+ "Modified: 23.12.1995 / 18:38:53 / cg"
!
+id
+ "return the processes id"
+
+ ^ id
+!
+
+name
+ "return the processes name"
+
+ ^ name
+!
+
+name:aString
+ "set the processes name"
+
+ name := aString
+!
+
+priority
+ "return the receivers priority"
+
+ ^ prio
+!
+
+priority:aNumber
+ "set my priority"
+
+ Processor changePriority:aNumber for:self.
+!
+
+restartable:aBoolean
+ "set/clear, the restartable flag.
+ Restartable processes will automatically be restarted by the
+ ProcessorScheduler upon image restart.
+ Others have to be restarted manually."
+
+ startBlock isNil ifTrue:[
+ self error:'cannot be made restartable when already started'.
+ ^ self
+ ].
+ restartable := aBoolean
+
+ "Modified: 23.12.1995 / 18:38:32 / cg"
+!
+
+singleStep:aBoolean
+ singleStepping := aBoolean
+!
+
+startBlock
+ "return the processes startup-block"
+
+ ^ startBlock
+!
+
+state
+ "return a symbol describing the processes state"
+
+ ^ state
+!
+
+state:aSymbol
+ "set the state - only to be used from scheduler"
+
+ state := aSymbol
+!
+
+suspendedContext
+ "return the processes suspended context
+ - this is the context from which a process switch into the scheduler
+ or another process occured.
+ Typically, only the debugger is interested in this one."
+
+%{ /* NOCONTEXT */
+ extern OBJ __threadContext();
+ OBJ i;
+
+ if (__isSmallInteger(i = _INST(id))) {
+ RETURN (__threadContext(_intVal(i)));
+ }
+%}.
+ ^ nil
+! !
+
+!Process methodsFor:'accessing-change notifications'!
+
emergencySignalHandler
"return the emergencySignalHandler block.
See Signal>>documentation for more info."
@@ -261,27 +349,26 @@
"Modified: 13.12.1995 / 13:44:03 / stefan"
!
-id
- "return the processes id"
+suspendAction:aBlock
+ "add aBlock to the processes suspend actions.
+ This block will be evaluated when a process gets suspended.
+ A nil argument removes all suspendActions."
- ^ id
-!
-
-isDead
- "return true, if the receiver has already terminated"
+ aBlock isNil ifTrue:[
+ suspendActions := nil.
+ ^ self.
+ ].
- ^ state == #dead
-!
-
-isRestartable
- "return true, iff the receiver is restartable"
+ suspendActions isNil ifTrue:[
+ suspendActions := OrderedCollection new
+ ].
+ suspendActions add:aBlock
- ^ restartable
-!
+ "Created: 13.12.1995 / 13:35:54 / stefan"
+ "Modified: 13.12.1995 / 13:44:31 / stefan"
+! !
-isSingleStepping
- ^ singleStepping
-!
+!Process methodsFor:'accessing-stack'!
maximumStackSize
"returns the processes stack limit - i.e. the process will be
@@ -299,50 +386,6 @@
^ nil
!
-name
- "return the processes name"
-
- ^ name
-!
-
-name:aString
- "set the processes name"
-
- name := aString
-!
-
-nameOrId
- "return a string to identify the process - either name or id"
-
- name notNil ifTrue:[^ name].
- ^ id printString
-!
-
-priority
- "return the receivers priority"
-
- ^ prio
-!
-
-priority:aNumber
- "set my priority"
-
- Processor changePriority:aNumber for:self.
-!
-
-restartable:aBoolean
- "set/clear, the restartable flag.
- Restartable processes will automatically be restarted by the
- ProcessorScheduler upon image restart. Others have to be restarted
- manually."
-
- startBlock isNil ifTrue:[
- self error:'cannot be made restartable when already started'.
- ^ self
- ].
- restartable := aBoolean
-!
-
setMaximumStackSize:limit
"sets the processes stack limit - i.e. the process will be
interrupted with a recursionSignal-raise, if it ever
@@ -377,64 +420,6 @@
}
%}.
^ false
-!
-
-singleStep:aBoolean
- singleStepping := aBoolean
-!
-
-startBlock
- "return the processes startup-block"
-
- ^ startBlock
-!
-
-state
- "return a symbol describing the processes state"
-
- ^ state
-!
-
-state:aSymbol
- "set the state - only to be used from scheduler"
-
- state := aSymbol
-!
-
-suspendAction:aBlock
- "add aBlock to the processes suspend actions.
- This block will be evaluated when a process gets suspended.
- A nil argument removes all suspendActions."
-
- aBlock isNil ifTrue:[
- suspendActions := nil.
- ^ self.
- ].
-
- suspendActions isNil ifTrue:[
- suspendActions := OrderedCollection new
- ].
- suspendActions add:aBlock
-
- "Created: 13.12.1995 / 13:35:54 / stefan"
- "Modified: 13.12.1995 / 13:44:31 / stefan"
-!
-
-suspendedContext
- "return the processes suspended context
- - this is the context from which a process switch into the scheduler
- or another process occured.
- Typically, only the debugger is interested in this one."
-
-%{ /* NOCONTEXT */
- extern OBJ __threadContext();
- OBJ i;
-
- if (__isSmallInteger(i = _INST(id))) {
- RETURN (__threadContext(_intVal(i)));
- }
-%}.
- ^ nil
! !
!Process methodsFor:'interrupts'!
@@ -636,6 +621,33 @@
(state == oldState1 or:[state == oldState2]) ifTrue:[state := newState]
! !
+!Process methodsFor:'queries'!
+
+isDead
+ "return true, iff the receiver is a dead process"
+
+ ^ (state isNil or:[state == #dead])
+
+ "Modified: 23.12.1995 / 18:35:29 / cg"
+!
+
+isRestartable
+ "return true, iff the receiver is restartable"
+
+ ^ restartable
+!
+
+isSingleStepping
+ ^ singleStepping
+!
+
+nameOrId
+ "return a string to identify the process - either name or id"
+
+ name notNil ifTrue:[^ name].
+ ^ id printString
+! !
+
!Process methodsFor:'special'!
millisecondDelay:millis
@@ -919,6 +931,6 @@
!Process class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Process.st,v 1.40 1995-12-16 12:23:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Process.st,v 1.41 1995-12-23 18:50:22 cg Exp $'
! !
Process initialize!