lock OS thread when MakeGitError might be called

This commit is contained in:
Quinn Slack 2014-11-18 04:57:26 -08:00
parent 609a9a3cdf
commit 8b39eb7953
1 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,9 @@ type BlameOptions struct {
} }
func DefaultBlameOptions() (BlameOptions, error) { func DefaultBlameOptions() (BlameOptions, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
opts := C.git_blame_options{} opts := C.git_blame_options{}
ecode := C.git_blame_init_options(&opts, C.GIT_BLAME_OPTIONS_VERSION) ecode := C.git_blame_init_options(&opts, C.GIT_BLAME_OPTIONS_VERSION)
if ecode < 0 { if ecode < 0 {
@ -63,6 +66,9 @@ func (v *Repository) BlameFile(path string, opts *BlameOptions) (*Blame, error)
} }
} }
runtime.LockOSThread()
defer runtime.UnlockOSThread()
ecode := C.git_blame_file(&blamePtr, v.ptr, C.CString(path), copts) ecode := C.git_blame_file(&blamePtr, v.ptr, C.CString(path), copts)
if ecode < 0 { if ecode < 0 {
return nil, MakeGitError(ecode) return nil, MakeGitError(ecode)