SimonWaldherr/bbmandelbrot.go — pull request #1 by ghthor (2014-08-10 16:59:33+00:00)
Title: Fixed a potential Race Condition

The access of the atomic variable `var done uint64` wasn't completely atomic.
Simplified creating and opening the output file and replaced the usage of panic in favor of log package.
Also fixed the column looping over width instead of height.

I also looked at whether `img.Set(x, y, colval)` was atomically safe and it seems fine to me. I made a version[1] that uses a channel to synchronize storing the `x, y, colval` data into the image and it runs a little bit slower, which is expected, but the status reports to the terminal about every % so it looks nice and pretty. This is probably because my VM has 2 cpus and when the accumulator go routine runs do the the channel's buffer being full it gives the update loop a chance to run as well.

[1] https://github.com/ghthor/bbmandelbrot.go/tree/sync-img