diff options
Diffstat (limited to 'vendor/modernc.org/sqlite/lib/mutex.go')
-rw-r--r-- | vendor/modernc.org/sqlite/lib/mutex.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/vendor/modernc.org/sqlite/lib/mutex.go b/vendor/modernc.org/sqlite/lib/mutex.go index 97a3902ba..0e81eb5c1 100644 --- a/vendor/modernc.org/sqlite/lib/mutex.go +++ b/vendor/modernc.org/sqlite/lib/mutex.go @@ -21,22 +21,25 @@ func init() { panic(fmt.Errorf("sqlite: thread safety configuration error")) } - varArgs := libc.Xmalloc(tls, types.Size_t(unsafe.Sizeof(uintptr(0)))) - if varArgs == 0 { - panic(fmt.Errorf("cannot allocate memory")) - } + switch fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) { + case "linux/amd64": + // experimental pthreads support currently only on linux/amd64 + default: + varArgs := libc.Xmalloc(tls, types.Size_t(unsafe.Sizeof(uintptr(0)))) + if varArgs == 0 { + panic(fmt.Errorf("cannot allocate memory")) + } - // experimental pthreads support currently only on linux/amd64 - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { // int sqlite3_config(int, ...); if rc := Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(varArgs, uintptr(unsafe.Pointer(&mutexMethods)))); rc != SQLITE_OK { p := Xsqlite3_errstr(tls, rc) str := libc.GoString(p) panic(fmt.Errorf("sqlite: failed to configure mutex methods: %v", str)) } + + libc.Xfree(tls, varArgs) } - libc.Xfree(tls, varArgs) tls.Close() } |