Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-02 Thread Ian Lance Taylor
On Jul 2, 2016 2:32 AM, "Alex Bligh" wrote: > > > On 2 Jul 2016, at 05:23, Matt Harden wrote: > > > Forking is not safe in Go either. > > Why? Let's assume one knows what one is doing and doesn't try to use channels etc. In general you can't use fork in a multi-threaded program, because a differ

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-02 Thread Alex Bligh
On 2 Jul 2016, at 05:23, Matt Harden wrote: > Forking is not safe in Go either. Why? Let's assume one knows what one is doing and doesn't try to use channels etc. -- Alex Bligh -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscr

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-02 Thread Tamás Gulácsi
What about os/exec with a C shim to setup what needs to be done and start the Go program, passing on given FDs for IPC? -- 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 ema

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-01 Thread Matt Harden
Forking is not safe in Go either. On Fri, Jul 1, 2016 at 11:34 AM Alex Bligh wrote: > > > On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > > > I see :-/ > > > > One very fragile workaround I've had in mind is to replace any > > occurrence of syscall.Syscall by syscall.Rawsyscall within ca

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-07-01 Thread Alex Bligh
> On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > I see :-/ > > One very fragile workaround I've had in mind is to replace any > occurrence of syscall.Syscall by syscall.Rawsyscall within call graph > of doSomeStuff(). However, the Go scheduler is not truly cooperative, > so unexpected p

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-06-30 Thread Martynas Pumputis
I see :-/ One very fragile workaround I've had in mind is to replace any occurrence of syscall.Syscall by syscall.Rawsyscall within call graph of doSomeStuff(). However, the Go scheduler is not truly cooperative, so unexpected preemption can happen during the execution (e.g. due to a stack growth)

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-06-29 Thread Ian Lance Taylor
On Tue, Jun 28, 2016 at 2:50 PM, Martynas Pumputis wrote: > > Recently I've bumped into a problem when using the Linux network > namespaces in Go. > > In my program I have the following function: > > func do() { > runtime.LockOSThread() > defer runtime.UnlockOSThread() > netns.Set(cont