async file writing

Started by
6 comments, last by kitkit 15 years, 10 months ago
Hi! My game writes huge data size to a file. I want to use async file writing. I develop my game at VS2003. In this game I write data to file using fwrite method, because it is a multi-platform one. But this method is not asynchronous method. In msdn I founded _fwrite_nolock method. This what I need, BUT I use VS2003, and in this version of "stdio" library this method is absent. !! Help me please!
----------------------

kit

Advertisement
Sorry, there's no platform independent async fwrite function. From what I gather you can create one yourself! If you're not comfortable with threads, that would be a great learning project.

There are tons of way to do this!
Nor are there really platform independent ways to create threads :)

You can use a multi-platform library though. But those might also exist for async file writing.
Million-to-one chances occur nine times out of ten!
Quote:Original post by fboivin
Sorry, there's no platform independent async fwrite function. From what I gather you can create one yourself! If you're not comfortable with threads, that would be a great learning project.


Threads don't bring much to the table in this case.

Windows supports overlapped IO. That one is the basis for all async IO, even files.

Under Linux, aio should serve the same purpose, but I've never looked into whether and how it works with files. But since everything is a file under Linux, intuition says it works.

But right now, I'm not aware of any out-of-box library that would support this.
Thanks you for you answers!!! I found such decision: I used a pthread library and fwrite method. Thanks, one more time... topic closed!
----------------------

kit

Quote:Original post by Mike nl
Nor are there really platform independent ways to create threads :)


Assuming you're using C++, boost::thread can be considered platform independent. Not only is it written to support native threads on a more than a couple of platforms, it is marked for inclusion in the next version of the C++ standard library.

Just something worth condsidering.



Quote:Original post by kitkit
Thanks you for you answers!!! I found such decision: I used a pthread library and fwrite method. Thanks, one more time... topic closed!


Just keep in mind that you're not doing asynchronous writing, you're doing writing in a thread. That's a different thing.
Thanks, I understand!
----------------------

kit

This topic is closed to new replies.

Advertisement