Blocking serial support: what do you want?
ned at bike-nomad.com
Wed Jun 12 04:39:20 UTC 2002
On Tuesday 11 June 2002 07:30 pm, Ian Piumarta wrote:
> Hi Ned,
> Async serial and async file pose very similar problems. Would it
> help if I were to spend a day implementing the the async file
> support? I would expect you to be able to adapt and/or simply
> share quite of bit of the same code in an async serial
> implementation. (To the support code, "it's all just descriptors".
That would help considerably. I looked at the aio.c code, and it looks
> You'd probably want to make this work like sockets. Do the i/o in
> nonblock mode and use the semaphore(s) to signal the image when
> read data and/or write space are available. The aio handlers
> should end up looking very similar to the socket ones.
Or do what Craig did with Flow and use separate blocking pthreads that
then signal semaphores.
> On the other hand, since you're starting from a clean slate, you
> have the chance to get the image/support interface _right_ w.r.t.
> to semaphores and signals. (Don't forget that Unix select()s on a
> descriptor for write when there is as little as one byte free in
> the underlying buffer. It's best if the support code can determine
> with absolute precision when the image is waiting on a semaphore
> and when it isn't. Simply select()ing all the time on a writable
> descriptor will keep Squeak in a very nasty busy loop.)
Is there a way to tell from the VM whether a particular semaphore is
being waited on? Or would this have to be handled through a primitive
>(since sometimes what you really want to do is wait on two
> semaphores simultaneously -- and this isn't possibile in one
> process without either VM modifications [aSema waitWith:
This would actually be handy anyway for generic timeouts, interrupts
from other threads, etc. Windows has the ability to wait for any (or
all) of a set of semaphores, and it turns out that this can simplify
> > Do any of you see a need for such a plugin?
> Might something like this be of help MIDI at all?
Depends on the MIDI interface. Built-in sequencers probably don't need
this kind of support, though I'm not sure. Ones that are simple
serial ports (like old Macs?) could probably benefit from it.
> > Anyone want to help?
> I'm happy to write the async file support, from which you should be
> able to bootstrap the async serial support more easily than doing
> it in-vacuo.
GPG key ID: BEEA7EFE
More information about the Squeak-dev