[squeak-dev] The Trunk: Kernel-ul.515.mcz

Levente Uzonyi leves at elte.hu
Mon Nov 15 21:48:54 UTC 2010


On Mon, 15 Nov 2010, Bert Freudenberg wrote:

>
> On 15.11.2010, at 20:45, Levente Uzonyi wrote:
>
>> On Mon, 15 Nov 2010, Juan Vuletich wrote:
>>
>>> Hi Folks,
>>>
>>> Please also restore Semaphore>>critical:ifLocked: It already includes this comment: "Note: The following is tricky and depends on the fact that the VM will not switch between processes while executing byte codes (process switches happen only in real sends). The following test is written carefully so that it will result in bytecodes only."
>>>
>>> To be more explicit, in Cuis it also says: "Do not change the following #== for #=, as #== is not a real message send, just a bytecode."
>>
>> It's unnecessary, because #= also has it's own bytecode in the current VM. So #= won't be a real message send in this case, because both excessSignals and 0 are SmallIntegers.
>>
>> Also, this method has a bug. There's no guarantee, that the sender won't wait for the semaphore. I uploaded a fix to the Inbox for review recently, though I didn't get any feedback on it: http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-November/155058.html
>
> Looks good, except I find the addition of passIfLocked: confusing.
>
> The only prior use of "pass" as verb in Squeak that I am aware of is in exception handling. To me it has no meaning wrt semaphores. The basic semaphore operations are "signal" and "wait", with "critical" being a combination of these.
>
> So what is this good for, and how would you express its operation in terms of existing semaphore functionality?

I was trying to find a good name, but this was the best I came up with. 
Sometimes semaphore's P is called pass. #waitIfLocked: reflects the 
semantics better, because the method acts like #wait if the semaphore has 
a signal, but it's against common sense, because the method won't wait if 
the semaphore is not signaled.


Levente

>
> - Bert -
>
>
>
>



More information about the Squeak-dev mailing list