Firstly I was treating async IO file reading wrong; I was treating a non-zero return from ReadFile() as an error, which is true normally but in AIO mode the 'error' is 'IO operation pending'. The net result was it was causing my Async loads to fail with an error about an IO operation pending; opps!
I've swapped the 'set error flag and return' methods in all the decoders to throw an exception instead, then at the call site the exception is caught, the error flag is set, so is an error message and if set an error callback is called.
I'm still considering dropping 'error' and replacing it with 'ioerror' and 'decode error' as those are the only two exceptions which are used.
Yes, callbacks are in; two exist 'loaded' and 'error' with the same signature for both; void func(GameTextureLoader3::ImagePtr, std::string const &) with the latter parameter being the filename which loaded/failed to load.
The call backs can be set at init time or via 'setCallbacks()' after that, both taking boost::function objects so no restriction on the function type called, as long as it can match the signature.
The 'process()' function now correctly update the 'state' of the object as it loads,with the stages being:
However the state can become 'error' after 'Loading' or 'Processing' due to that being the location when errors can occur.
So, it looks like everything finally works, which is nice [grin]
I'll ponder for a bit longer to see if anything else needs doing and, if not, get a Beta release (Win32, MSVC only for now) up later tonight.
I'm currently updating my Gentoo VM so that I can work on the Linux IO and threading issues. The later introducing a dependancy on pthreads most probably and the former using the POSIX AIO API (which I'm currently reading up on). This should be an intresting learning experiance [grin]