News for hackers. Stuff that matters.
Re:Intro to images in Go – concurrency by stevenbedrick on Friday November 01, 2013 @10:49AM (#6654114)
This is probably a stupid question, but is the Canvas's DrawLine function thread-safe? It looks like multiple Nodes could be drawing to the same canvas at the same time, and I don't see any locks/mutexes/whatevers wrapping that call.

Obviously it can't be too much of a big deal, since the (very nifty) example works just fine, but I'm curious about what's going on here.

Re:Intro to images in Go – concurrency by icebraining on Friday November 01, 2013 @02:11PM (#6655338)
I'm a noob at concurrent programming, but from what I can tell, the only concurrent mutation is when setting the pixels, in image.go:

    94		p.Pix[i+0] = c1.R
    95		p.Pix[i+1] = c1.G
    96		p.Pix[i+2] = c1.B
    97		p.Pix[i+3] = c1.A
IIRC, copying a single byte is safe, so what could happen is that you could end up with weird pixels, if two nodes were setting the same pixel at the same time.