Tuesday, July 29, 2008
Return of the I/O Loop
The I/O loop, using Niels Provos' LibEvent, is back in the WaspVM trunk, along with some of the TCP/IP functionality and expanded timeout functionality. This doesn't work on Windows at the moment, because Windows requires Sockets, the Console and Devices to be treated differently; I will probably have to write a new I/O loop from scratch for Windows. (We had this problem in Mosquito, too; we just ignored the console, and used netcat to provide a console interface..)
I know that the I/O loop was supposed to be deferred until after WaspDoc, but we were getting into some dire straits at work, with a few devices with very primitive serial chipsets. If we uploaded parameters faster than roughly 16 bytes per 100ms, the buffers would overflow and the device would crash. The new pause primitive, which accepts an optional duration in milliseconds, lets a process rest periodically to let the wretched controller to digest each transmission.
Originally, I wrote this script using Python, but.. Bleh. Too complex. :)