I am working on a 3D game which needs to load lots of 3D-resource when players come to new place. In order to keep game playing smoothly, I tried to load resource asynchronously.
Multiple-threads is a good choice, however, I needs to hander many things by myslef.
So, I tried ReadFileEx. According to the MSDN, "The
ReadFileEx function reads data from a file asynchronously. It
is designed solely for asynchronous operation".
To my opinion, "asynchronous" means the function will return immediately so that I can do other things until the callback function will be called.
To my surprise, when I first call ReadFileEx to load one file, it will take long time (about hundreds milliseconds) to return ! It's not acceptable for a online game. I think ReadFileEx was doing some initializing work, such as finding the file on disk, setting up DMO, etc and these works take long time to complete.
So, it means I must use multiple-threads instead of asynchronous IO to handle this problem. Am I right? Any suggestion will be apprieciable.