Add the newer missing thread-locking instances
This commit is contained in:
parent
8c631b0c25
commit
520a0425c7
7
diff.go
7
diff.go
|
@ -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)
|
||||
|
|
14
odb.go
14
odb.go
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue