On Mon, Mar 15, 2021 at 12:17 PM Jason E. Aten <j.e.a...@gmail.com> wrote: > > On Monday, March 15, 2021 at 12:58:38 PM UTC-5 Ian Lance Taylor wrote: >> >> I think it is too strong to say that the scheduler is the "bottleneck" >> in calling C code, but I believe that the operations required to tell >> the scheduler what is happening to the goroutine are the most costly >> parts of a call into C code. > > > Thanks Ian! I looked through > https://github.com/golang/go/tree/master/src/cmd/cgo but couldn't > locate where the CGO communication with the scheduler happens. Could you > point out the code?
It is in runtime.cgocall, notably the calls to entersyscall and exitsyscall. Also pay attention to runtime.cgocallbackg, which is invoked when calling back from C to Go. Both functions are in src/runtime/cgocall.go. It will help to review the long comment at the start of that file. Ian -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXgvi5DfffbSUHn0WWq4sLtYW4bn7R2hhaDSgoWyvKGeA%40mail.gmail.com.