summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-04-21 13:14:22 +0200
committerPatrick Steinhardt <[email protected]>2015-05-22 09:02:24 +0200
commit7750e85fd1ff1006a28a5e292c9bc7ce3e12b586 (patch)
tree73178aaba5dbd83c81cc925f16fbd6cc9004a121 /git.go
parent193deb7ae3cbc5d5a1f7f186aae6edb20bff950a (diff)
Introduce an indirection layer for pointers
As the Go runtime can move stacks at any point and the C code runs concurrently with the rest of the system, we cannot assume that the payloads we give to the C code will stay valid for any particular duration. We must therefore give the C code handles which we can then look up in our own list when the callbacks get called.
Diffstat (limited to 'git.go')
-rw-r--r--git.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/git.go b/git.go
index 9496d2d..4f1a65e 100644
--- a/git.go
+++ b/git.go
@@ -93,7 +93,11 @@ var (
ErrInvalid = errors.New("Invalid state for operation")
)
+var pointerHandles *HandleList
+
func init() {
+ pointerHandles = NewHandleList()
+
C.git_libgit2_init()
// This is not something we should be doing, as we may be