summaryrefslogtreecommitdiff
path: root/handles.go
diff options
context:
space:
mode:
Diffstat (limited to 'handles.go')
-rw-r--r--handles.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/handles.go b/handles.go
index d27d3c3..c0d4b3c 100644
--- a/handles.go
+++ b/handles.go
@@ -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()