Re: [go-nuts] Shiny

2017-07-22 Thread sqweek E.
There's also go.wde: https://github.com/skelterjohn/go.wde Although the widget situation is no better there (intentionally; it's reason to exist is to provide a platform independent interface to windows/framebuffers/events). Wde doesn't do mobile at all, but has pretty decent support for win32/

[go-nuts] Re: Initialize a nested autogenerated structure

2016-09-15 Thread sqweek E.
Once you have the JSON encoded data in a byte slice, pass those bytes into json.Unmarshal along with a reference to a variable of type AutoGenerated (or whatever you decide to rename it to). ie: import "encoding/json" ... var bytes []byte var data AutoGenerated bytes = loadJSONFromDB(

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-15 Thread sqweek E.
On Wednesday, September 14, 2016 at 2:58:24 AM UTC+8, Henrik Johansson wrote: > > I think this will be an interesting read especially if you come from Java. > > https://shipilev.net/blog/2016/close-encounters-of-jmm-kind/ > There were some surprises in there! With a bit more perspective I can se

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-13 Thread sqweek E.
On Tuesday, September 13, 2016 at 10:57:47 PM UTC+8, Alan Donovan wrote: > > On 13 September 2016 at 10:33, 'Paul Borman' via golang-nuts < > golan...@googlegroups.com > wrote: > >> That said, a map is represented by a single machine word (32 or 64 >> bits). I don't know of any modern architectur

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-13 Thread sqweek E.
On Tuesday, September 13, 2016 at 9:48:06 AM UTC+8, Caleb Spare wrote: > > See > https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong. > > > I've read this article before and the second reading hasn't done much to improve my impression. The premise i

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread sqweek E.
— i.e. not communicating by sharing memory, but rather > sharing memory by communicating. > > > On Mon, Sep 12, 2016 at 6:04 PM, sqweek E. > > wrote: > > Yes, through plain assignment. What problems arise from that? > > > > On Monday, September 12, 2016 a

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread sqweek E.
t; safe. You could use sync/atomic.Value if you always made sure to do > map reads via the Load method. > > On Mon, Sep 12, 2016 at 5:04 PM, sqweek E. > > wrote: > > instead of updating the maps in place, they (a) take a > > copy of the current map (b) update the

[go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread sqweek E.
Ok so after getting away with using maps to share data between threads for a lng time, I've finally seen the light and accepted that this is not safe. In my case the threads in question are a painter thread and a mouse/keyboard event processing thread. They want to share data because obvio