The write-csv function in clojure.data.csv isn't thread safe because even though it uses the synchronized .write method on BufferedReader, it does so at the cell level <https://github.com/clojure/data.csv/blob/master/src/main/clojure/clojure/data/csv.clj#L101>, not the row/line level. Is this expected or a bug? Is there a reason it shouldn't be made thread safe?
Attached is a simple test showing the result of calling write-csv with a single thread vs. 100 threads. With a single thread, the output is correct, and with 100 threads the result is a jumbled mess. Conversely, if I use clojure-csv <https://github.com/davidsantiago/clojure-csv> and manually write at the row level using the same harness, it works as expected with multiple threads. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
user.clj
Description: Binary data