diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-12-06 02:44:57 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-12-06 02:45:26 +0100 |
| commit | 8c631b0c25c8de616afa2fd89378299c9d9a1439 (patch) | |
| tree | 4f37d5612f17bc13a0a3d1b71019711430eab0c4 /diff.go | |
| parent | 0ec2f4665913a37df6f4d5704ea3a69bae2eb8b3 (diff) | |
Add missing thread locking
Diffstat (limited to 'diff.go')
| -rw-r--r-- | diff.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -287,6 +287,9 @@ func (diff *Diff) Patch(deltaIndex int) (*Patch, error) { } var patchPtr *C.git_patch + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_patch_from_diff(&patchPtr, diff.ptr, C.size_t(deltaIndex)) if ecode < 0 { return nil, MakeGitError(ecode) @@ -348,6 +351,10 @@ type DiffOptions struct { func DefaultDiffOptions() (DiffOptions, error) { opts := C.git_diff_options{} + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_diff_init_options(&opts, C.GIT_DIFF_OPTIONS_VERSION) if ecode < 0 { return DiffOptions{}, MakeGitError(ecode) @@ -487,6 +494,9 @@ func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts *DiffOptions) ( } } + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_diff_tree_to_tree(&diffPtr, v.ptr, oldPtr, newPtr, copts) if ecode < 0 { return nil, MakeGitError(ecode) @@ -536,6 +546,9 @@ func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts *DiffOptions) (*Diff, } } + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_diff_tree_to_workdir(&diffPtr, v.ptr, oldPtr, copts) if ecode < 0 { return nil, MakeGitError(ecode) |
