mirror of
https://github.com/ceph/go-ceph
synced 2024-12-20 13:21:32 +00:00
b3f7c6af15
As per the Go Wiki page on cgo [1] passing callback with data between C and Go is non-trivial due to the pointer passing rules [2]. This change creates a new helper type, based on the examples on the wiki, that uses opaque indexes to exchange between C and Go. For now, this type is simple as we're only going to have a few callbacks initially but this could easily be improved and made more general in the future as needed. Because we anticipate having to use this type in all of our core packages (rados and cephfs as well as rbd) we are creating the type in an "internal" package so that we don't treat the new type as public despite the capitalized method names. [1]: https://github.com/golang/go/wiki/cgo [2]: https://golang.org/cmd/cgo/#hdr-Passing_pointers Signed-off-by: John Mulligan <jmulligan@redhat.com> |
||
---|---|---|
.. | ||
callbacks_test.go | ||
callbacks.go |