Shared Reading and Writing.

Started by
14 comments, last by Thevenin 17 years, 9 months ago
Quote:Original post by Nypyren
Other than that, the FileShare.ReadWrite will probably work fine if you make sure your write buffer is flushed or the stream is closed before readers are allowed to read).


Considering that the two threads are running independent of eachother, I can't make sure my write buffer is flushed before a reader reads it.

Are you absolutely certian that there is a possibility that the read will read the partially written data?

Advertisement
It will try and read partially written data if the stars align and it happens to be trying to read the last information from the file at the same time as it is being written. We're talking down to the ms's here, but with two seperately running processes, there's no telling when one or the other will try and perform their reading or writing functions.
Bah, I knew my cheesy text file forum and text file characters would come back to bite me. Oh why didn't I listen to those crazy people shouting 'Use MySQL'. [bawling]

Mutex is poorly documented, and probably would be just as difficult for me to implement as say.. MySQL. I'm going to need some time to think about this. [depressed]

Quote:...Mutex is poorly documented...

There are hundreds of thousands of web pages with info and even more books!!!!!
Quote:Original post by Anonymous Poster
Quote:...Mutex is poorly documented...

There are hundreds of thousands of web pages with info and even more books!!!!!


When you consider the size of the internet, hundreds of thousands seems soo little. Also, google didn't return any matches that I could follow along with.

Obviously Mutex is properly documented, its just I can't find tutorials that I can understand. I might just swallow the 'glow in the dark' pill and implement MySQL.
Wait a minute!

Why don't I just have the server make duplicates every minute of all the characters online into a backup folder which is read only by the web server.

To notify the server when a backup folder is flushed, I'll create a Done.txt file to signal it.

The web server will be a minute behind on the data, but thats perfectly fine given my critiera.

Its soo simple... [smile]

This topic is closed to new replies.

Advertisement