Essentially, we have a website that reads a .png image, and a C program that overwrites that .png image. The reading happens twice a second, and the writing happens five times a second (To ensure that it is always the most up to date image when the reading happens).
The issue is the website will sometimes read incomplete images that were in the process of being overwritten. These cause images that have big black parts missing and sometimes corrupted images to be drawn by the website instead of valid images.
If these were threads I would use mutexes, but because it's a website with simply html/js I don't know how to synchronize this. I was thinking of lock files but it seems like that might be pretty inefficient.
Is there a good simple way to overcome this synchronization issue? Or is lock files the only way to go?
Thank you for your time.
Subreddit
Post Details
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/AskProgramm...