aio in win32 .. how?

Michael Roberts mike at mjr104.co.uk
Fri Dec 12 16:10:41 UTC 2003


On Fri, Dec 12, 2003 at 04:20:08PM +0100, Andreas Raab wrote:
> That's one of the reason why I prefer to just fire off another thread which
> does the operation synchronously ;-)

I hadn't thought of that...

> 
> > I have had a quick look at the SM card for aio and it seems 
> > (on the face of it) that you could do the notfication stuff 
> > using a windows event object to get signalled when the async 
> > operation is complete.  You would need a windows thread to go
> > to sleep on the event object, however, but that's details I guess.
> 
> Very important details though. 
sorry, I didn't mean that to be flippant.  I figured that you indeed have a detailed perspective on these things.

>For example, I had considered switching to
> events in the socket code and have the main thread wait on those in
> MsgWaitForMultipleObjects (or whatever it's called today) but it turns out
> that there's a significant shortcoming in that function - it fails if
> invoked with more than 64 objects to wait on. 

I didn't know that.  what a mess.  

>So this would require
> splitting up the waits into separate sub-threads (each dealing with 64 event
> objects) and then synchronize those. Geesh, what a mess. So by my figuring
> the easiest solution is just to fire off a thread for each op.
> 
yep.  That sounds a good solution.

btw, do you know that there is a problem with the timer resolution for Windows event objects?  Depending on the implementation of the Windows NT HAL (I found a paper on the web) you can get varying resolution from a call like Sleep(1) or waitForSingleObject(event, timeout) that varies from 1ms to 16ms.  I wrote a test program and ran it on all the machines in the office and got really worrying results.  There is a hack available using timeBeginPeriod(), timeEndPeriod() where you can get the linker to link in multimedia timers.  Windows then does some bodge to improve the resolution of your events.  It totally sucks.  I wasn't sure if you had come across this and whether it impacted anything in the VM area.

Cheers

Mike



More information about the Squeak-dev mailing list