diff options
| author | Carlos Martín Nieto <[email protected]> | 2013-12-18 07:19:02 -0800 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2013-12-18 07:19:02 -0800 |
| commit | 66e1c476199ebcd3e304659992233132c5a52c6c (patch) | |
| tree | 115fcae49287c82eb55bb275cbbd4556fbed72b7 /index.go | |
| parent | 625ffd022e2c39f3820543cc1239deeb21837266 (diff) | |
| parent | a40bdfd4202db244bfc5da348a0f0c528ef122cd (diff) | |
Merge pull request #41 from libgit2/cmn/threading
Lock the OS thread when acessing errors
Diffstat (limited to 'index.go')
| -rw-r--r-- | index.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -24,6 +24,9 @@ func (v *Index) AddByPath(path string) error { cstr := C.CString(path) defer C.free(unsafe.Pointer(cstr)) + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_index_add_bypath(v.ptr, cstr) if ret < 0 { return LastError() @@ -34,6 +37,10 @@ func (v *Index) AddByPath(path string) error { func (v *Index) WriteTree() (*Oid, error) { oid := new(Oid) + + runtime.LockOSThread() + defer runtime.UnlockOSThread() + ret := C.git_index_write_tree(oid.toC(), v.ptr) if ret < 0 { return nil, LastError() |
