I work with two independent c / C ++ applications on Windows, where one of them constantly updates the image on disk (from a web camera), and the other reads this image for processing. This works fine and dandy 99.99% of the time, but from time to time the reader application is in the middle of reading the image when the author removes it in order to update it with a new one.
The obvious solution for me, it seems, is that the reader has some kind of lock in the file so that the writer can see that he cannot delete it and thus block it until he can delete and update. is there any way to do this? Or is there another simple design pattern that I can use to get the same constant image refresh between two programs?
Thank,
-Robert
source
share