-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
HANDLE types should support Sync trait #396
Comments
You should be wrapping your handles in a newtype so that you can do stuff like automatically closing the handle when dropped. One of the benefits of such a wrapper is you can assert that it is thread safe like so: struct Handle(HANDLE);
unsafe impl Sync for Handle {} Related issue: #360 |
I see. Does it make sense for This would also introduce a level of type safety that isn't present in C/C++ with Windows handles. |
|
I'm new to Rust, so if my understanding is misguided, do let me know.
I'm trying to use a handle -
HMODULE
in a staticHashMap
. This is not allowed because the traitstd::marker::Sync
is not satisfied on*mut winapi::HINSTANCE__
.I think
DECLARE_HANDLE
should define a type that supports theSync
trait.Handles are not pointers even though they're defined that way in
winnt.h
.The text was updated successfully, but these errors were encountered: