summaryrefslogtreecommitdiff
path: root/walk.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 /walk.go
parent625ffd022e2c39f3820543cc1239deeb21837266 (diff)
parenta40bdfd4202db244bfc5da348a0f0c528ef122cd (diff)
Merge pull request #41 from libgit2/cmn/threading
Lock the OS thread when acessing errors
Diffstat (limited to 'walk.go')
-rw-r--r--walk.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/walk.go b/walk.go
index 9fc4094..6979b6b 100644
--- a/walk.go
+++ b/walk.go
@@ -8,6 +8,7 @@ import "C"
import (
"io"
+ "runtime"
)
// RevWalk
@@ -34,6 +35,9 @@ func (v *RevWalk) Push(id *Oid) {
}
func (v *RevWalk) PushHead() (err error) {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
ecode := C.git_revwalk_push_head(v.ptr)
if ecode < 0 {
err = LastError()
@@ -43,6 +47,9 @@ func (v *RevWalk) PushHead() (err error) {
}
func (v *RevWalk) Next(oid *Oid) (err error) {
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
ret := C.git_revwalk_next(oid.toC(), v.ptr)
switch {
case ret == ITEROVER: