IOHandle V1.2 for Squeak3.4alpha. This is beta level code, bugs are likely.
IOHandle adds classes which represent input/output on external channels such as files or sockets. The FileStream and Socket hierarchies are modified to use IOHandle rather than to directly invoke primitives. Instances of FileStream or Socket collaborate with instances of IOHandle to separate streaming and protocol behaviors from behaviors related to external device and network access.
The purpose of IOHandle is to: - Separate the representation of external IO channels from the represention of streams and communication protocols. - Provide a uniform representation of IO channels similar to the unix notion of treating everything as a 'file'. - Simplify future refactoring of Socket and FileStream. - Provide a place for handling asynchronous IO events. Refer to the aio handling in the unix VM. Files, Sockets, and AsyncFiles could (should) use a common IO event handling mechanism (aio event signaling a Smalltalk Semaphore).
If used with OSProcess, please update to OSProcessV3.0.4. OSProcess should be loaded prior to installing IOHandle (if loading OSProcess after IOHandle, just proceed through several error notifiers and all will be well).
I have not yet integrated this with Flow (it's a lot of work). If there is interest, I'll have a bash at it as soon as Flow can be loaded into an image along side the existing classes.
These change sets put my initials (dtl) on a lot of methods which were really written by other people. This needs to be fixed; I can take credit for lots of new errors but not for the code.
I moved the registries for StandardFileStream and Socket into class IOHandle. I'm not sure I got this all right, and I probably screwed up Andreas' StandardFileStream>>retryWithGC:until:forFileNamed: when I replaced it with IOHandle>>retryWithGC:until:forRegisterObject. Also, I moved the registry threshold methods from Socket to IOHandle. They were not being used in Socket, but these appear to be in place to prevent the registry from becoming too large. Removing things from a large registry is extremely slow, so it would probably be a good idea to put these methods to use.
There are some minimal hooks for aio event handling in class IOHandle. I have done an implementation of aio event forwarding for Unix pipes, and it works quite well (I have not released that code yet). Class IOHandle would be a good place to put this to allow the event handling to work identically for sockets, pipes, and files.
IOHandle cannot be easily removed from the system, so please begin with a fresh copy of your image before loading IOHandle.
Dave
squeak-dev@lists.squeakfoundation.org