summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/sqlite/lib/mutex.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-11-27 15:26:58 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-27 15:26:58 +0100
commit182b4eea73881c611a0f519576aa6ad2aa6799c2 (patch)
tree230fac469690fcee8797b13585e739be148d4789 /vendor/modernc.org/sqlite/lib/mutex.go
parentRequire confirmed email when checking oauth token (#332) (diff)
downloadgotosocial-182b4eea73881c611a0f519576aa6ad2aa6799c2.tar.xz
Update dependencies (#333)
Diffstat (limited to 'vendor/modernc.org/sqlite/lib/mutex.go')
-rw-r--r--vendor/modernc.org/sqlite/lib/mutex.go17
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()
}