I have an unmanaged code that calls an asynchronous managed method that returns a handle, and then the unmanaged code use that handle to wait, reading a little documentation I found out that SafeWaitHandle provide 2 other methods (DangerousAddRef
and DangerousRelease
).
Should I use these methods in order to prevent the Handle from not being release? As the name of the method DangerousGetHandle
suggest, it seems to me that I should be very careful with something, what is so dangeour here?
Edit: Is there a better way to implement this scenario (not dangerously)?