2019-12-19 15:58:58 +01:00
|
|
|
// Copyright 2019 The Sqlite Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package sqlite // import "modernc.org/sqlite"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
"unsafe"
|
|
|
|
|
2020-08-26 23:31:54 +02:00
|
|
|
"modernc.org/libc"
|
|
|
|
"modernc.org/libc/sys/types"
|
2019-12-19 15:58:58 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type mutex struct {
|
|
|
|
sync.Mutex
|
|
|
|
}
|
|
|
|
|
2021-04-21 20:56:00 -07:00
|
|
|
func mutexAlloc(tls *libc.TLS) uintptr {
|
|
|
|
return libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{})))
|
2019-12-21 11:00:50 +01:00
|
|
|
}
|
|
|
|
|
2020-08-26 23:31:54 +02:00
|
|
|
func mutexFree(tls *libc.TLS, m uintptr) { libc.Xfree(tls, m) }
|