Tom Ramcigam (magicmarmot) wrote,
Tom Ramcigam


Two separate programs, two separate operating systems, both dealing with the same file. One is writing, the other is reading.

Unfortunately the one that is reading has a higher priority, so it attempts to read the file before it is completely written.

Best way to deal with the problem would be to create a file resource lock (semaphore), but with the current structure of one of the programs, that gets really icky. File access points are scattered all over the place.

My fix: in the reader program, check to see if the file exists, and sleep if it doesn't. In the writer, write a temporary file and rename it when it's done. Gonna see if that works.
Tags: codegeek
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.