1
2
3
4
5
6
7 package race
8
9 import (
10 "runtime"
11 "unsafe"
12 )
13
14 const Enabled = true
15
16 func Acquire(addr unsafe.Pointer) {
17 runtime.RaceAcquire(addr)
18 }
19
20 func Release(addr unsafe.Pointer) {
21 runtime.RaceRelease(addr)
22 }
23
24 func ReleaseMerge(addr unsafe.Pointer) {
25 runtime.RaceReleaseMerge(addr)
26 }
27
28 func Disable() {
29 runtime.RaceDisable()
30 }
31
32 func Enable() {
33 runtime.RaceEnable()
34 }
35
36 func Read(addr unsafe.Pointer) {
37 runtime.RaceRead(addr)
38 }
39
40 func Write(addr unsafe.Pointer) {
41 runtime.RaceWrite(addr)
42 }
43
44 func ReadRange(addr unsafe.Pointer, len int) {
45 runtime.RaceReadRange(addr, len)
46 }
47
48 func WriteRange(addr unsafe.Pointer, len int) {
49 runtime.RaceWriteRange(addr, len)
50 }
51
52 func Errors() int {
53 return runtime.RaceErrors()
54 }
55
View as plain text