c# - Reading a file without preventing other processes from reading it at the same time -
i'm making little app in c#/.net watch creation of file , when created gets content, parse , write in file.
everything working fine far. problem : there's process watch file well. process reading file while second 1 reads , deletes it.
my application making job when reads file, other process can't read , totally crashes (not made me , don't have sources fix it).
my application running fast , other open files little time content , put in variable close file faster , parse content of file in variable.
i don't know how i'd able read file , let other read file @ same time without hiccups. possible? still think there problem fact file being deleted after other app done parsing it...
any suggestions or ideas?
thanks much!
kiss: can have file created in location first program isn't looking at, software - , when done processing move current location first program is looking?
otherwise: going have contention since it's going race see process "notices" file first , begins working.
i'm assuming don't have control on process creating file?
in case might @ pssuspend or pausesp - if can control other process suspending until ready (done file) might viable. not sure how robust be.
there's still potential race condition of "noticing" file , performing action (whatever is) - keeping other process paused perpetually until want run (or killing , starting it) deterministic way achieve want within constraints.
Comments
Post a Comment