github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/internal/race/race.go (about) 1 // Copyright 2015 The Go 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 //go:build race 6 // +build race 7 8 package race 9 10 import ( 11 "runtime" 12 "unsafe" 13 ) 14 15 const Enabled = true 16 17 func Acquire(addr unsafe.Pointer) { 18 runtime.RaceAcquire(addr) 19 } 20 21 func Release(addr unsafe.Pointer) { 22 runtime.RaceRelease(addr) 23 } 24 25 func ReleaseMerge(addr unsafe.Pointer) { 26 runtime.RaceReleaseMerge(addr) 27 } 28 29 func Disable() { 30 runtime.RaceDisable() 31 } 32 33 func Enable() { 34 runtime.RaceEnable() 35 } 36 37 func Read(addr unsafe.Pointer) { 38 runtime.RaceRead(addr) 39 } 40 41 func Write(addr unsafe.Pointer) { 42 runtime.RaceWrite(addr) 43 } 44 45 func ReadRange(addr unsafe.Pointer, len int) { 46 runtime.RaceReadRange(addr, len) 47 } 48 49 func WriteRange(addr unsafe.Pointer, len int) { 50 runtime.RaceWriteRange(addr, len) 51 } 52 53 func Errors() int { 54 return runtime.RaceErrors() 55 }