Forgot to reply to the list. Oops. Sorry for the second delivery, Changkun.
On Mon, Feb 15, 2021 at 12:39 changkun <h...@changkun.de> wrote: > Hi Ian, > > Thanks for the hint, but I have some follow-up questions: > > >> Even if there were a way to do this, an atomic variable is not a good >> synchronization mechanism, because the other side has to poll the >> variable. > > Indeed, it the other side will be a spin loop to poll the atomic variable, > which ... > > > >> You can do this as a last resort, but it doesn't sound like >> you are at a last resort here. I suggest that you have your C >> function call a Go function to write a value on a channel. > > seems easy to write than this (?). > > Say a Go function foo is called from the C side, to be able to send to the > corresponding channel, C must pass that channel to the Go function, which > brings to the initial question: pass a channel from Go to C, is it > supported at the moment (?) > > How could a Go function be able to send content to differently allocated > channels in correspondingly invoked C functions? > I think this is only a problem if you need a separate channel per invocation for some reason, which seems unlikely. But if you did, you could have a map of int to chan T and pass the integer key through C. Kind regards, --dho > > > Sincerely, > Changkun > > -- > 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/7adba3a6-ee2f-4923-905d-9afc2b9f796an%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/7adba3a6-ee2f-4923-905d-9afc2b9f796an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAFgOgC_zWPuPtNAc74CM7aimNh7k-ZbNT_TsFbCntWDT6mX_VQ%40mail.gmail.com.