mutex.go 502 B

1234567891011121314151617181920212223
  1. // Copyright 2019 The Sqlite Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package sqlite // import "modernc.org/sqlite"
  5. import (
  6. "sync"
  7. "unsafe"
  8. "modernc.org/libc"
  9. "modernc.org/libc/sys/types"
  10. )
  11. type mutex struct {
  12. sync.Mutex
  13. }
  14. func mutexAlloc(tls *libc.TLS) uintptr {
  15. return libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{})))
  16. }
  17. func mutexFree(tls *libc.TLS, m uintptr) { libc.Xfree(tls, m) }