[go-nuts] Help with Go channels and select talk

2019-12-09 Thread luka . venac
You can do it without a goroutine as long as the channel has at least one buffer slot so execution passes to the select and uses the data. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails f

Re: [go-nuts] What is the fundamental unit of linking in Go?

2019-06-29 Thread luka . venac
Yes, I thought about it and I am quite sure that it would be very complex code detecting referenced but unused code. I am just starting with learning how to break things apart properly. Go makes it easy to modularise but old bad habits to make monolithic stuff don't dissolve overnight, and in m

Re: [go-nuts] What is the fundamental unit of linking in Go?

2019-06-28 Thread luka . venac
I am pretty sure that every folder in a Go code repository creates one binary object, maybe two with a test package alongside it. It just didn't occur to me that it would not trace the execution path of the main, and where each of the closures/function references in this case are stored in a ma

[go-nuts] What is the fundamental unit of linking in Go?

2019-06-28 Thread luka . venac
I have come up against something a bit strange and interesting that I didn't really expect from the Go compiler. I have a main which uses a structure created in a package, which contains a whole load of references to other packages. What I discovered is that even though only one of these includ

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-13 Thread Luka Napotnik
Ok, thanks for the clarification. On Tue, Feb 14, 2017 at 12:53 AM Ian Lance Taylor wrote: > On Mon, Feb 13, 2017 at 1:14 PM, wrote: > > On Monday, February 13, 2017 at 7:02:22 AM UTC+1, Luka Napotnik wrote: > >> > >> I forgot to mention that the main goroutine in t

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread Luka Napotnik
Thanks for the answers. I'll play around with C.gettid. Greets, On Mon, Feb 13, 2017 at 7:06 AM, Ian Lance Taylor wrote: On Sun, Feb 12, 2017 at 9:57 PM, Luka Napotnik wrote: Thanks for the reply. I've created a test program with function F1 that calls a C function F2. The f

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread Luka Napotnik
I forgot to mention that the main goroutine in the test program is locked to a thread as I call runtime.LockOSThread() in init() Greets, On Mon, Feb 13, 2017 at 6:57 AM, Luka Napotnik wrote: Thanks for the reply. I've created a test program with function F1 that calls a C function F2

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread Luka Napotnik
Thanks for the reply. I've created a test program with function F1 that calls a C function F2. The function F2 then calls a Go function F3. I've started the test once with GOMAXPROCS set to 1, and the second time without an env. (using Go 1.7). There are short pauses between calls and I've mea

[go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread luka
k the main goroutine inside a OS thread). Am I correct? Also, what happens if the called CGO function calls a Go function? Can it happen that the Go runtime will create a new thread, because the previous one is still locked? Greets, Luka -- You received this message because you are subs