[Vm-dev] Why isn't signalSemaphoreWithIndex() thread-safe?

John M McIntosh johnmci at smalltalkconsulting.com
Sun Sep 20 20:00:16 UTC 2009


Well there is no generic synchronizing code, so you are correct it has  
to be platform specific.
When I wrote the original code a decade? back in the macintosh os-9  
era there was no agreement
about doing platform specific implementations since at the time there  
was a tendency to keep all
the code as generic as possible.

So do you have a test case or scenario where the code fails?

On 2009-09-20, at 12:43 PM, Joshua Gargus wrote:

>
> Hi,
>
> I've always assumed that signalSemaphoreWithIndex() must be thread- 
> safe;
> after all, it's the "official" mechanism for notifying the image  
> that an
> asynchronous event has occurred.  However, a pang of paranoia prompted
> me to actually look at the code, and it seems clearly unsafe.  This is
> bad, because I've been using it to signal events from separate native
> threads.
>
> What should we do about this?  It seems to me that it should be  
> wrapped
> in a critical section, using the appropriate platform-specific
> synchronization primitives.
>
> Thanks,
> Josh

--
= 
= 
= 
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>   Twitter:   
squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================






More information about the Vm-dev mailing list