diff options
Diffstat (limited to 'handles.go')
| -rw-r--r-- | handles.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -43,6 +43,16 @@ func (v *HandleList) Untrack(handle unsafe.Pointer) { v.Unlock() } +// Clear stops tracking all the managed pointers. +func (v *HandleList) Clear() { + v.Lock() + for handle := range v.handles { + delete(v.handles, handle) + C.free(handle) + } + v.Unlock() +} + // Get retrieves the pointer from the given handle func (v *HandleList) Get(handle unsafe.Pointer) interface{} { v.RLock() |
