Hello!

My code: https://play.golang.org/p/pg-p17UuEW
I'm trying to append lines to a file concurrently.

My first write() function is buggy, because WriteString() are called by 
several goroutines in unexpected order.

So, I've written writeMutex(), that uses a mutex.
It works as expected, but in my real code, I'd prefer to avoid mutex.
(in my real code write() can write to different files; the file's name is 
given as argument)

I've also written writeBuffer().
Is it OK to call f.Write() 1 time from several goroutines?
It looks like it works, but I'm not 100% sure this is correct.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to