mutex.go (502B)
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 5 package sqlite // import "modernc.org/sqlite" 6 7 import ( 8 "sync" 9 "unsafe" 10 11 "modernc.org/libc" 12 "modernc.org/libc/sys/types" 13 ) 14 15 type mutex struct { 16 sync.Mutex 17 } 18 19 func mutexAlloc(tls *libc.TLS) uintptr { 20 return libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) 21 } 22 23 func mutexFree(tls *libc.TLS, m uintptr) { libc.Xfree(tls, m) }