[Questions]Events

John M McIntosh johnmci at smalltalkconsulting.com
Fri Jul 28 23:35:37 UTC 2000


on 7/28/00 12:27 PM, Tim Rowledge at tim at sumeru.stanford.edu wrote:

> In message <3981D6C8.9639FE71 at bike-nomad.com>
> Ned Konz <ned at bike-nomad.com> wrote:
> 
> 
>> Does anyone know whether it's possible to signal an external
>> Semaphore asynchronously? I looked at doing just this (including using SIGIO)
>> for the Serial stuff, but didn't know how it would work.
> You can use signalSemaphoreWithIndex asynchronously, but the semaphore
> wil only get _actually_ signalled the next time checkForInterrupts is
> called. 
> 

Well... assuming signalSemaphoreWithIndex is perfectly interrupt safe is
dangerous if you are driving it at a high interrupt rate from multiple OS
threads. Right now it uses a non-atomic counter to track queued signals, if
you hit things just right you could miss a signal. Also beware the table
only holds 500 signals at time, so doing a burst of 1000 signals could be an
issue. 

In 2.8 I changed much of the code to fix some issues with how stuff gets
deposited in the queue, versus how checkForInterrupts removes stuff from the
queue, this solved most of the issues with lost signals, but to be *perfect*
it would require the use of atomic operators to manage it's structure.

--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================





More information about the Squeak-dev mailing list