Commit Graph

1 Commits

Author SHA1 Message Date
Sven Anderson 780f7014a2 internal: use runtime.Pinner in PtrGuard
Since Go 1.21 there is a runtime.Pinner API that allows to safely
pass structures with embedded Go pointers to C code.  In earlier Go
version we know that the garbage collector is non-moving, so it is
safe to pass Go pointers to C as well. This change adds two
implementations of PtrGuard, one for pre 1.21 that is basically a
no-op, and one for 1.21+ that uses runtime.Pinner.

Signed-off-by: Sven Anderson <sven@redhat.com>
2023-10-23 14:21:27 +00:00