Question

Edit: This question is moot. I misread the date on the commit, it is included in existing versions of the Go tools. Thanks, James!

It seems that the upcoming release of Go (1.3) will allow non-Go threads to call CGO callbacks.

I'm wondering what people have typically done to get around this restriction to date.

That is, I have a third party library that creates threads on its own, and I would like to get some information from those threads into the Go code.

Some sort of a handoff mechanism from a C thread to a Go thread on the "C" side of the code? Some way to get a message onto a queue without calling into Go? Other ideas?

Was it helpful?

Solution

The commit you've highlighted was from February last year, which is from before the Go 1.1 release. It also references issue 4435, which is tagged Go1.1.

I'm not sure what people did to get around the restriction previously (if it was indeed possible), but for the last two released versions of the language, there has been no need to employ work arounds. I've made use of the ability in a number of my projects without incident.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top