Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do you assert! if the thread is panicking in your Drop implementation? #106

Open
jymchng opened this issue Jan 28, 2024 · 1 comment

Comments

@jymchng
Copy link

jymchng commented Jan 28, 2024

https://github.com/stouset/secrets/blob/master/src/secret.rs#L215

For the Drop implementation of Secret<T> (linked above), why do you assert if the thread is panicking when the target is not on Windows and munlock was successful?

My purpose is to understand and learn from you.

Thank you.

@U007D
Copy link

U007D commented Jul 3, 2024

The comments say that attempting to munlock() a second item on the same page on Windows is expected to return an error, and is being ignored.

As I read it, the code says that if munlock() failed and this isn't on a Windows system (and the last OS error code was 158), then that's a problem (ie. we must panic) unless we're already panicking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants