[ENH][VM][UNIX]generalized async IO

Lex Spoon lex at cc.gatech.edu
Mon Feb 26 15:02:08 UTC 2001


Tim Rowledge <tim at sumeru.stanford.edu> wrote:
> 
> 
> Lex Spoon wrote:
> > 
> > I've patched the Unix VM so that any part of the VM -- including plugins
> > -- may now register file descriptors to be checked with select()
> > whenever ioRelinquishProcessor() is called.  I also updated the
> > XWindows, sound, and sockets modules to use this general mechanism
> > instead of their own private one.
> Excellent move; how did you handle the need for different nuymbers of
> arguments in the original code?

Hrm, I don't understand.  What functions need different numbers
of arguments?

In the code I've posted, modules register descriptors via two functions:

	aioHandle(descriptor, handler, data, eventMask)
	aioStopHandling(descriptor)

When the "handler" is invoked, it will be passed the single argument
"data", which was specified in the aioHandle() call.  So, you can pass
arbitrary amounts of data to the handler through this mechanism, by
creating a struct for the purpose.  Sockets are the only module that use
this right now, and they already have a convenient struct around for the
purpose.

Also, naturually, handler's are passed the values of the read, write,
and exception flags that select() returns for the relevant descriptor.

Overall, there's nothing really clever here.  It's just taking Ian's
existing code, sticking it at global scope, and modifying some of the
interfaces so that they aren't specific to sockets.  If you're thinking
of anything sophisticated, I probably didn't do it.  :)


> 
> While you're tidying up, you  might like to remove the calls to
> joystickInit(), serialInit() etc in sqXWindow.c - they're not needed at
> all with plugins since those functions are called by the plugin-local
> init code.If you leave them in and build a vm with the appropriate
> plugins external you get problems.

Good idea!  I don't want to do it myself, though, because I'm already
suggesting so many changes to Ian.  One thing at a time....


-Lex





More information about the Squeak-dev mailing list