From 8b39eb795340dff00f16f93d6e9d154fabc98b14 Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Tue, 18 Nov 2014 04:57:26 -0800 Subject: lock OS thread when MakeGitError might be called --- blame.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blame.go b/blame.go index 5384038..55100a4 100644 --- a/blame.go +++ b/blame.go @@ -16,6 +16,9 @@ type BlameOptions struct { } func DefaultBlameOptions() (BlameOptions, error) { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + opts := C.git_blame_options{} ecode := C.git_blame_init_options(&opts, C.GIT_BLAME_OPTIONS_VERSION) 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) if ecode < 0 { return nil, MakeGitError(ecode) -- cgit v1.2.3