mirror of
https://github.com/logos-storage/nim-libplum.git
synced 2026-06-07 01:29:27 +00:00
Add safety guard when destroying the mapping
This commit is contained in:
parent
9867ec4787
commit
4532517ca5
@ -266,6 +266,10 @@ proc createMapping*(
|
||||
|
||||
proc destroyMapping*(id: cint) {.raises: [].} =
|
||||
## Must be called exactly once after a successful createMapping.
|
||||
## Safe to call again or on an unknown id
|
||||
withSafeLock:
|
||||
if id notin activeMappings:
|
||||
return
|
||||
discard plum_destroy_mapping(id)
|
||||
|
||||
proc hasMapping*(id: cint): bool {.raises: [].} =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user