Re: How to wait for file closing?

new topic     » goto parent     » topic index » view thread      » older message » newer message
useless_ said...

You're correct. The biggest problem with using the OS to lock a file is if the app crashes, the file remains locked, and no one can use it until you manually unlock it.

This does not appear to be the case on Linux, BTW (it's not clear which OS the OP is using). I added a sleep(100) in my write.ex after writing but before closing the file, and then killed the process manually while it was sleeping. Afterwards, read.ex was able to read the file normally. However, the buffer did out appear to have automatically flushed when I killed the program. Adding a call to flush() before the sleep() call worked.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu