c# - Is there a better approach for dealing with mulitple processes reading/writing to a file -


i have 3 processes each of listens data feed. 3 processes need read , update same file after receiving data. 3 processes keep running whole day. obviously, each process needs have exclusive read/write lock on file.

i use "named mutex" protect read/write of file or can open file using fileshare.none.

would these 2 approaches work? 1 better?

the programe written in c# , runs on windows.

use named mutex this. if open file fileshare.none in 1 process, other processes exception thrown when attempt open file, means have deal waiting , retrying etc. in these processes.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -