Process>>terminate woes
Gary Chambers
gazzaguru2 at btinternet.com
Wed Dec 5 18:28:35 UTC 2007
If we intend to modify/enhance the VM what about the old classic
#valueUninterrupatably (VA didn't quite pin it totally down, but it did the
job, mostly). That is, a way of doing something totally atomically with
respect to the VM. To be used sparingly, of course!
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org]On Behalf Of
> Andreas Raab
> Sent: 05 December 2007 4:44 PM
> To: The general-purpose Squeak developers list
> Subject: Re: Process>>terminate woes
>
>
> Lukas Renggli wrote:
> >> I've also noticed that Process>>isTerminated is not thread-safe...
> >
> > And #signalException:
>
> Good one. Yes, this needs fixing.
> My suggestion would be (with the other changes):
>
> signalException: anException
> | oldList |
> self isActiveProcess ifTrue: [^anException signal].
>
> "Suspend myself first to ensure that I won't run away in the
> midst of the following modifications."
> oldList := self suspend.
>
> "Add a new method context to the stack that will signal the exception"
> suspendedContext := MethodContext
> sender: suspendedContext
> receiver: self
> method: (self class lookupSelector: #pvtSignal:list:)
> arguments: (Array with: anException with: oldList).
>
> "If we were on a list to run, then suspend and restart the receiver
> (this lets the receiver run if it is currently blocked on a
> semaphore). If
> we are not on a list to be run (i.e. this process is suspended), then
> when the
> process is resumed, it will signal the exception"
>
> oldList ifNotNil: [self resume].
>
> Cheers,
> - Andreas
>
More information about the Squeak-dev
mailing list
|