-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPool.go
40 lines (35 loc) · 793 Bytes
/
Pool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package bone
import "sync"
var boneObjectTrack struct {
sync.Mutex
m map[uintptr]interface{}
// c int
}
func boneObjectAdd(c uintptr, v interface{}) {
boneObjectTrack.Lock()
defer boneObjectTrack.Unlock()
if boneObjectTrack.m == nil {
boneObjectTrack.m = make(map[uintptr]interface{})
}
if boneObjectTrack.m[c] != nil {
panic("Bone Address Corruption")
}
boneObjectTrack.m[c] = v
}
func boneObjectLookup(c uintptr) interface{} {
boneObjectTrack.Lock()
defer boneObjectTrack.Unlock()
ret := boneObjectTrack.m[c]
if ret == nil {
panic("Bone Object Not Found")
}
return ret
}
func boneObjectDelete(c uintptr) {
boneObjectTrack.Lock()
defer boneObjectTrack.Unlock()
if boneObjectTrack.m[c] == nil {
panic("Bone Object Not Found")
}
delete(boneObjectTrack.m, c)
}