summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2013-12-18 07:19:02 -0800
committerCarlos Martín Nieto <[email protected]>2013-12-18 07:19:02 -0800
commit66e1c476199ebcd3e304659992233132c5a52c6c (patch)
tree115fcae49287c82eb55bb275cbbd4556fbed72b7 /commit.go
parent625ffd022e2c39f3820543cc1239deeb21837266 (diff)
parenta40bdfd4202db244bfc5da348a0f0c528ef122cd (diff)
Merge pull request #41 from libgit2/cmn/threading
Lock the OS thread when acessing errors
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/commit.go b/commit.go
index c633e2d..498669e 100644
--- a/commit.go
+++ b/commit.go
@@ -9,6 +9,7 @@ extern int _go_git_treewalk(git_tree *tree, git_treewalk_mode mode, void *ptr);
import "C"
import (
+ "runtime"
"time"
"unsafe"
)
@@ -25,6 +26,9 @@ func (c Commit) Message() string {
func (c Commit) Tree() (*Tree, error) {
var ptr *C.git_object
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
err := C.git_commit_tree(&ptr, c.ptr)
if err < 0 {
return nil, LastError()