summaryrefslogtreecommitdiff
path: root/status.go
diff options
context:
space:
mode:
authorBen Navetta <[email protected]>2014-08-25 18:20:54 -0400
committerBen Navetta <[email protected]>2014-08-25 18:20:54 -0400
commit0059b26255190153337c3ce43c675606a044c1c1 (patch)
tree593c7928565abf05c0f101ad59bdcce878db934e /status.go
parent33ae83f4d9b78501549fc880c1e2dd055466808c (diff)
add thread locking to status api
Diffstat (limited to 'status.go')
-rw-r--r--status.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/status.go b/status.go
index 644b13e..f69cd14 100644
--- a/status.go
+++ b/status.go
@@ -8,6 +8,7 @@ import "C"
import (
"runtime"
+ "unsafe"
)
type Status int
@@ -150,6 +151,9 @@ func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) {
}
}
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
ret := C.git_status_list_new(&ptr, v.ptr, copts)
if ret < 0 {
return nil, MakeGitError(ret)
@@ -161,6 +165,11 @@ func (v *Repository) StatusList(opts *StatusOptions) (*StatusList, error) {
func (v *Repository) StatusFile(path string) (Status, error) {
var statusFlags C.uint
cPath := C.CString(path)
+ defer C.free(unsafe.Pointer(cPath))
+
+ runtime.LockOSThread()
+ defer runtime.UnlockOSThread()
+
ret := C.git_status_file(&statusFlags, v.ptr, cPath)
if ret < 0 {
return 0, MakeGitError(ret)