I am trying to do the same, but according to my understanding you can't do that in Golang. When fork is called on Linux, the duplicated child process is created with only one thread - the thread that called fork. This basically means your child process no longer has a working Go runtime/environment.
Cheers, Lei On Sunday, September 16, 2018 at 11:44:18 AM UTC+8, Kasun Vithanage wrote: > > I'm developing a *redis **like *server with Go. You can see the code repo > here <https://github.com/kasvith/kache>. > I need to dump my *Mutex Protected map* to a *file*. Simply *snapshot > data to a file*. > > In redis, it take snapshots of data using a fork as described in here > <http://oldblog.antirez.com/post/redis-persistence-demystified.html>. > > // DB holds a thread safe struct for store data > type DB struct { > file map[string]*DataNode > mux sync.RWMutex > } > > Here is my map. > > Is there a possibility in go to do this? I want to be my original DB to be > lock free and non touched while the persistent carries on. > -- 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.