Hi folks,

I've been having some difficulty coming up with a scheme for writing
to files in a thread-safe manner. The files are named with the hash of
their content, so they are effectively immutable.

The problem comes with writing them for the first time. I need to
ensure that while a file is initially being written, no other thread
attempts to read or write to the file.

The best solution I've come up with so far is to write to a temporary
file, then rename the file to its hash once it has been closed. This
seems to work, but I'd be very interested to know how other people
have handled similar concurrent I/O problems in Clojure.

- James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to