Coming soon - Get a detailed view of why an account is flagged as spam!
view details
1
How do you overcome synchronization issues across separate programs/stacks with files?
Post Flair (click to view more posts with a particular flair)
Post Body

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.

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
47,706
Link Karma
3,451
Comment Karma
44,141
Profile updated: 6 days ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 years ago