[squeak-dev] The Trunk: Kernel-ar.238.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Sep 4 04:51:35 UTC 2009
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.238.mcz
==================== Summary ====================
Name: Kernel-ar.238
Author: ar
Time: 3 September 2009, 9:50:51 am
UUID: 9896c3f8-760f-e942-ac84-5f6c9127150c
Ancestors: Kernel-ar.237
http://bugs.squeak.org/view.php?id=7321
Change Set: AtomicProcessSuspend
Date: 23 March 2009
Author: Andreas Raab
In-image support for atomic process suspend.
=============== Diff against Kernel-ar.237 ===============
Item was changed:
----- Method: Process>>suspend (in category 'changing process state') -----
suspend
+ "Primitive. Stop the process that the receiver represents in such a way
- "Stop the process that the receiver represents in such a way
that it can be restarted at a later time (by sending the receiver the
message resume). If the receiver represents the activeProcess, suspend it.
+ Otherwise remove the receiver from the list of waiting processes.
+ The return value of this method is the list the receiver was previously on (if any)."
+ | oldList |
+ <primitive: 88>
+ "This is fallback code for VMs which only support the old primitiveSuspend which
+ would not accept processes that are waiting to be run."
+ myList ifNil:[^nil]. "this allows us to use suspend multiple times"
+ oldList := myList.
+ myList := nil.
+ oldList remove: self ifAbsent:[].
+ ^oldList!
- Otherwise remove the receiver from the list of waiting processes."
-
- self isActiveProcess ifTrue: [
- myList := nil.
- self primitiveSuspend.
- ] ifFalse: [
- myList ifNotNil: [
- myList remove: self ifAbsent: [].
- myList := nil].
- ]
- !
Item was changed:
----- Method: Process>>offList (in category 'accessing') -----
offList
+ "OBSOLETE. Process>>suspend will atomically reset myList if the process is suspended.
+ There should never be a need to send #offList but some older users may not be aware
+ of the changed semantics to suspend and may try the old hickadidoo seen here:
- "Inform the receiver that it has been taken off a list that it was
- suspended on. This is to break a backpointer."
+ (suspendingList := process suspendingList) == nil
+ ifTrue: [process == Processor activeProcess ifTrue: [process suspend]]
+ ifFalse: [suspendingList remove: process ifAbsent:[].
+ process offList].
+
+ Usages like the above should be replaced by a simple 'process suspend' "
myList := nil!
Item was changed:
----- Method: Process>>terminate (in category 'changing process state') -----
terminate
"Stop the process that the receiver represents forever. Unwind to execute pending ensure:/ifCurtailed: blocks before terminating."
+ | ctxt unwindBlock oldList |
- | ctxt unwindBlock inSema |
self isActiveProcess ifTrue: [
ctxt := thisContext.
[ ctxt := ctxt findNextUnwindContextUpTo: nil.
ctxt isNil
] whileFalse: [
unwindBlock := ctxt tempAt: 1.
unwindBlock ifNotNil: [
ctxt tempAt: 1 put: nil.
thisContext terminateTo: ctxt.
unwindBlock value].
].
thisContext terminateTo: nil.
+ self suspend.
+ ] ifFalse:[
+ myList ifNotNil:[oldList := self suspend].
+ suspendedContext ifNotNil:[
- myList := nil.
- self primitiveSuspend.
- ] ifFalse: [
- "Since the receiver is not the active process, drop its priority to rock-bottom so that
- it doesn't accidentally preempt the process that is trying to terminate it."
- priority := 10.
- myList ifNotNil: [
- myList remove: self ifAbsent: [].
- "Figure out if the receiver was terminated while waiting on a Semaphore"
- inSema := myList class == Semaphore.
- myList := nil].
- suspendedContext ifNotNil: [
"Figure out if we are terminating the process while waiting in Semaphore>>critical:
In this case, pop the suspendedContext so that we leave the ensure: block inside
Semaphore>>critical: without signaling the semaphore."
+ (oldList class == Semaphore and:[
- (inSema == true and:[
suspendedContext method == (Semaphore compiledMethodAt: #critical:)]) ifTrue:[
suspendedContext := suspendedContext home.
].
ctxt := self popTo: suspendedContext bottomContext.
ctxt == suspendedContext bottomContext ifFalse: [
self debug: ctxt title: 'Unwind error during termination']].
].
!
Item was removed:
- ----- Method: Process>>primitiveSuspend (in category 'changing process state') -----
- primitiveSuspend
- "Primitive. Stop the process that self represents in such a way
- that it can be restarted at a later time (by sending #resume).
- ASSUMES self is the active process.
- Essential. See Object documentation whatIsAPrimitive."
-
- <primitive: 88>
- self primitiveFailed!
More information about the Squeak-dev
mailing list
|