Hi, I'm currently tackling a head scratching problem (at least for me).
First, I'll start by explaining my main goal: I have an in memory 'map[string]*SomeStructPointer' that I want to JSON encode and write to a file. Now since I want to prevent concurrent access to the map, I need to lock-down access to it during the JSON encoding. I want to avoid that locking or have it held for the smallest amount of time. Next, my idea: Fork the process, leveraging the copy-on-write, JSON encode the good stuff, write it to a file, then exit the child process. During that time, I wouldn't need to lock-down access to the map since the forked process would have its own copy of the memory I pretty much wanted to do what Redis does, but in Golang, and for a multi-threaded process which I now learned is not really possible (please correct me if I'm wrong I'd be happy). So, with that failed idea behind me, I'm looking at how I could accomplish this in Golang while being memory efficient. I'm opened to a lot of ideas, but I'd consider myself intermediate in Golang and beginner in C (if the answer involves CGO) so I might need detailed examples if we get in deep low level stuff. I'd also like to have something that is pure Golang code since I'll be cross compiling this on multiple architectures using the go compiler. Obviously, if more details are needed to answer the question, I'd be happy to provide them. Thanks in advance! - Julien -- 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.