[Vm-dev] Explicitly avoiding process switch

Henrik Johansen henrik.s.johansen at veloxit.no
Thu Aug 11 12:28:23 UTC 2011


On Aug 11, 2011, at 2:11 37PM, Igor Stasenko wrote:

> 
> On 11 August 2011 13:17, Nicolas Cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
>> 
>> I would properly comment the places where this "ATOMIC" operation is
>> really used.
> 
> Like in
> AtomicQueueItem>>makeCircular? :)
> 
> 
> I also remember discussion that some precautions in code to not insert
> suspension point(s) in ProcessorScheduler/Process/or Semaphore..
> but i forgot which one exactly.
> Is it LinkedList>>removeLink:?

http://code.google.com/p/pharo/issues/detail?id=3498

So suspension points in remove:ifAbsent (as written now)  and removeLink: are ok.
Not in removeLink:ifAbsent: though.

Used to be:
	link := self linkOf: aLinkOrObject ifAbsent: [^aBlock value].
	self removeLink: link.
	^aLinkOrObject

Because, well, I didn't think you'd ever get in a situation where :
1) two processes would try to remove the same link
2)  first of them suspends after link assignment
3) second carries through, and actually removes link
4) first calls removeLink: , and default block raising error is triggered when link is not found.

Cheers,
Henry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110811/9edb676b/attachment.htm


More information about the Vm-dev mailing list