diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-12-06 02:58:28 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-12-06 03:03:26 +0100 |
| commit | 520a0425c736c7d584d21d073b08a8735dd2464f (patch) | |
| tree | af5f03129117c9179dcdf71c11c867116fb24ab5 | |
| parent | 8c631b0c25c8de616afa2fd89378299c9d9a1439 (diff) | |
Add the newer missing thread-locking instances
| -rw-r--r-- | diff.go | 7 | ||||
| -rw-r--r-- | odb.go | 14 | ||||
| -rw-r--r-- | remote.go | 3 |
3 files changed, 24 insertions, 0 deletions
@@ -179,6 +179,9 @@ func (diff *Diff) FindSimilar(opts *DiffFindOptions) error { } } + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_diff_find_similar(diff.ptr, copts) if ecode < 0 { return MakeGitError(ecode) @@ -404,6 +407,10 @@ type DiffFindOptions struct { func DefaultDiffFindOptions() (DiffFindOptions, error) { opts := C.git_diff_find_options{} + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ecode := C.git_diff_find_init_options(&opts, C.GIT_DIFF_FIND_OPTIONS_VERSION) if ecode < 0 { return DiffFindOptions{}, MakeGitError(ecode) @@ -168,6 +168,10 @@ func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) { // known in advance func (v *Odb) NewWriteStream(size int, otype ObjectType) (*OdbWriteStream, error) { stream := new(OdbWriteStream) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.size_t(size), C.git_otype(otype)) if ret < 0 { return nil, MakeGitError(ret) @@ -221,6 +225,10 @@ func (stream *OdbReadStream) Read(data []byte) (int, error) { header := (*reflect.SliceHeader)(unsafe.Pointer(&data)) ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Cap) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_odb_stream_read(stream.ptr, ptr, size) if ret < 0 { return 0, MakeGitError(ret) @@ -253,6 +261,9 @@ func (stream *OdbWriteStream) Write(data []byte) (int, error) { ptr := (*C.char)(unsafe.Pointer(header.Data)) size := C.size_t(header.Len) + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_odb_stream_write(stream.ptr, ptr, size) if ret < 0 { return 0, MakeGitError(ret) @@ -264,6 +275,9 @@ func (stream *OdbWriteStream) Write(data []byte) (int, error) { // Close signals that all the data has been written and stores the // resulting object id in the stream's Id field. func (stream *OdbWriteStream) Close() error { + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_odb_stream_finalize_write(stream.Id.toC(), stream.ptr) if ret < 0 { return MakeGitError(ret) @@ -610,6 +610,9 @@ func (o *Remote) Ls(filterRefs ...string) ([]RemoteHead, error) { var refs **C.git_remote_head var length C.size_t + runtime.LockOSThread() + defer runtime.UnlockOSThread() + if ret := C.git_remote_ls(&refs, &length, o.ptr); ret != 0 { return nil, MakeGitError(ret) } |
