refMap is a convenient way to store opaque references that can be passed to C. It is useful if an API uses function pointers and you cannot pass a Go pointer but only a C pointer.
| 12 | // C. It is useful if an API uses function pointers and you cannot pass a Go |
| 13 | // pointer but only a C pointer. |
| 14 | type refMap struct { |
| 15 | refs map[unsafe.Pointer]interface{} |
| 16 | lock sync.Mutex |
| 17 | } |
| 18 | |
| 19 | // Put stores a value in the map. It can later be retrieved using Get. It must |
| 20 | // be removed using Remove to avoid memory leaks. |
nothing calls this directly
no outgoing calls
no test coverage detected